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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

aggregate column

Thread ID:

Created:

Updated:

Platform:

Replies:

149646 Dec 4,2019 12:24 PM UTC Dec 6,2019 04:10 AM UTC Angular - EJ 2 3
loading
Tags: PivotView
Suman Kumar
Asked On December 4, 2019 12:24 PM UTC

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

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

Sivamathi Natarajan [Syncfusion]
Replied On 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. 


Suman Kumar
Replied On 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



Sivamathi Natarajan [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon