Any way to perform a "Median" aggregation function using Pivot View?

We are wanting to use the Angular Pivot View control in our application to allow our users to report on data.

One feature that has been requested is the ability to display the median value of a row/column in the Pivot View. I noticed there are lots of aggregation funcitons (https://ej2.syncfusion.com/angular/documentation/pivotview/aggregation/) including an "average" function, but there is no "median" function. I could find no way to add a custom aggregate function, either. Is there a way to do this? If not, are there any plans to add such a function?


7 Replies 1 reply marked as answer

SN Sivamathi Natarajan Syncfusion Team August 19, 2020 01:25 PM UTC

Hi Michael Evans, 
 
We have logged your requirement – “Provide "median" aggregation support in pivot table” as a feature task and it will be available in any one of our upcoming release. You can track the same by using the following link:    
 
 
Meanwhile, you can apply any custom aggregation using aggregateCellInfo event. Please check the below UG for your reference. 
 
 
We appreciate your patience until then. 
 
Regards, 
Sivamathi. 



SS Saranya Sivan Syncfusion Team January 28, 2021 04:42 PM UTC

Hi Michael, 
  
We are glad to announce that our Essential Studio 2020 Volume 4 Service Pack Release v18.4.0.39 is rolled out where the requested feature “Provide median aggregation support in pivot table” has been included and is available for download under the following link.  
  
  
Now you can display the median aggregation by specifying the type of aggregation. Meanwhile, we have prepared a sample for your reference. Please check the below sample link. 
  
Code Snippet: 
  
ngOnInit(): void { 
    this.dataSourceSettings = { 
      columns: [{ name: "Year" }, { name: "Quarter" }], 
      values: [ 
        { name: "Sold", caption: "Units Sold", type: "Median" }, 
        { name: "Amount", caption: "Sold Amount" } 
      ], 
      dataSource: this.getPivotData(), 
      rows: [{ name: "Country" }, { name: "Products" }], 
    }; 
  } 
  
  
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
  
Regards,  
Saranya. 



Marked as answer

ME Michael Evans January 28, 2021 04:55 PM UTC

Hi Saranya,

I have tested changing the aggregation type to Median and it appears to work correctly. Thank you!

However, while testing I found that if I do not have any fields in the Row or Column Axis, and try to click the More button in the list of aggregate functions:


Then nothing happens and I get the following error in the console:




If there is a field in the Row or Column axis then the dialog appears and I am able to select an alternate aggregation function (like Median).

This really isn't related to the initial request but I thought you might want to know about it.


SS Saranya Sivan Syncfusion Team January 29, 2021 12:38 PM UTC

Hi Michael Evans, 
  
We considered “Script error throws while clicking aggregation menu” as a bug and logged a defect report in our data base. And it will be available in 2021 Vol 1, release which is estimated to be rolled in the mid of March, 2021. 
  
You can track the task in the following link. 
  
  
We appreciate your patience until then. 
  
Regards, 
Saranya Sivan. 
 



SS Saranya Sivan Syncfusion Team February 16, 2021 04:51 PM UTC

Hi Michael, 
  
We have fixed the reported issue (Script error throws while clicking aggregation menu) in weekly release (v18.4.0.43). Meanwhile, we have prepared a sample for your reference. Kindly check the same in the below link.  
  
  
Please let us know if you have concern.  
  
Regards,  
Saranya.  
 



ME Michael Evans February 18, 2021 03:44 PM UTC

Verified the new issue has been corrected with the latest release. Thank you!


SS Saranya Sivan Syncfusion Team February 19, 2021 05:49 AM UTC

Hi Michael, 
 
Thanks for the reply. 
  
Please let us know if you have any other queries. We are always happy to assist you.  
  
Regards,  
Saranya. 
 


Loader.
Up arrow icon