Display multiple aggregation types on the same field

I want to display two or more different aggregation type on the SAME field. Apparently it is impossible, unless there is some obscure option.

In the Fields List, I want to be able to drag a field, let's say field1 to the values, and select the aggregation type as SUM. Now, I want to drag THE SAME field, field1, to the values and select the aggregation type as AVG and be able to display BOTH the average and the SUM of the field1 in the pivot table at the SAME TIME. The fields list chooser does not let me drag the same field again...

Thanks!

1 Reply

SN Sivamathi Natarajan Syncfusion Team March 9, 2020 01:08 PM UTC

 
Thanks for contacting Syncfusion support. 
 
We regret you to let you know that the mentioned requirement is not a valid one. Since you cannot drag and drop the same fields with different aggregated types in Pivot Table component.  But you can create a specific field with different aggregation using calculated field feature. Created fields will be displayed in field list. Now you can drag and drop the required fields. Please check the below code example. 
 
// Here we have created average and count aggregated type for Sold field 
 
calculatedFieldSettings: [ 
                { 
                    name: 'AvgOfSold', 
                    formula: 'Avg(Sold)' 
                }, 
               { 
                    name: 'CountOfSold', 
                    formula: 'Count(Sold)' 
                }] 
 
 
Also, you can create the calculated fields dynamically with its built-in dialog. Please refer online demo and documentation for your reference. 
 
Meanwhile, we have prepared a sample for your reference. Kindly check the below sample link for your reference. 
 
 
Please check the below screenshot. We have included the AvgOfSold and CountOfSold fields in field list along with the default type sum Sold field. Now you can drag and drop the fields from field list. 
 
 
Here we have drag and drop the created fields in pivot table. 
 
 
 
We hope the above sample meets your requirements. Please let us know if you have concern. 
 
Regards, 
Sivamathi. 


Loader.
Up arrow icon