We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

aggregate column

can we have different aggregate columns for different columns in pivot table?

example : column 1 has sum, column has average and like this

3 Replies

SN Sivamathi Natarajan Syncfusion Team December 5, 2019 05:45 AM UTC

 
Thanks for contacting Syncfusion Support. 
 
You can set unique aggregation type to each value fields. So, we have prepared a sample for your reference where we have set unique aggregation types to the bound value fields. Kindly check the below code example.  
 
Example: Column 1 (Unit Sold) is Sum, Column 2 (Sold Amount) is Average, Column 3 (Quarter) is Count. 
 
Code Example: 
 
 this.dataSourceSettings = { 
            enableSorting: true, 
            columns: [{ name: 'Year' }], 
            values: [{ name: 'Sold', caption: 'Units Sold', type: 'Sum'  }, { name: 'Amount', caption: 'Sold Amount', type: 'Avg' }, { name: 'Quarter', caption: 'Quarter', type: 'Count' }], 
            dataSource: this.getPivotData(), 
            rows: [{ name: 'Country' }], 
            formatSettings: [{ name: 'Amount', format: 'C0' }], 
            expandAll: false, 
            filters: [] 
        }; 
 
 
Please check the below screenshots of displaying different aggregated for each column. 
 
 
 
 
 
 
 
 
Meanwhile, we have prepared sample as per your requirements. Kindly check the below sample link. 
 
 
Please let us know if you have concern. 
 
We hope that the above sample will meet your requirement. 
 
Regards, 
Sivamathi. 



SK Suman Kumar December 5, 2019 09:04 AM UTC

Hi Sivamathi,

Thank you very much!! 

However, My question was row wise aggregation  for all columns.
For example, in below screenshot, application calculates "average" column for Cat,Dog and Human column but i want different function for each of they like avg,sum and count




SN Sivamathi Natarajan Syncfusion Team December 6, 2019 04:10 AM UTC

Hi Suman, 
 
Thanks for your reply. 
 
Your requirement can be achieved by keeping one value axis field as reference and create separate fields with different aggregation type by using calculated fields option. Kindly check the below sample and documentation link. 
 
 
 
We hope the above sample will meet your requirement. 
 
Regards, 
Sivamathi. 


Loader.
Live Chat Icon For mobile
Up arrow icon