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

Axis Specific Aggregates or Custom Aggregate Override

Thread ID:

Created:

Updated:

Platform:

Replies:

146781 Aug 19,2019 07:38 PM UTC Aug 21,2019 04:41 AM UTC JavaScript - EJ 2 3
loading
Tags: PivotView
Doug Lenos
Asked On August 19, 2019 07:38 PM UTC

Hello:

I'm working on satisfying a requirement using the Javascript PivotView.  I need to display different aggregates on each axis for a given value.  Ideally, I would be able to explicitly define an aggregate for each value by axis, but I'm not sure I'm able to do that with this control.

For Example, the below pivot showcases my desired outcome:

Example ABCExample DEFExample GHIGrand Totals (Averages)

TotalTotalTotalTotal
Example 1232464
Example 4565555
Grand Totals (Summation)79119

Currently, I have each value set to average, so i only need to "override" the aggregates at the bottom to reflect a summation.  I'm hoping I can "override" the values either in an event (load, enginePopulating, enginePopulated, dataBound, ...) or in a cellTemplate.

I appreciate any suggestions or advice in achieving the desired functionality.


Thanks


Scintilla Arul Jothi Raj [Syncfusion]
Replied On August 20, 2019 01:18 PM UTC

Hi Doug, 

Thanks for contacting Syncfusion support. Please find the response below. 

We have validated your query and it is not an appropriate behavior for pivot table control. Meanwhile, you can achieve your requirement manually in “enginePopulated” event. Please find the following code snippet for your reference. 

Code snippet: [JavaScript] 
enginePopulated: function(args) { 
          var sumValue =0, count =0; 
           
          for(var i=0; i<args.pivotValues.length; i++){ 
            for(var j=0; j<args.pivotValues.length; j++){ 
              debugger 
              if(args.pivotValues[i][j]!= undefined && args.pivotValues[i][j].axis == "column" && args.pivotValues[i][j].formattedText != "Grand Total") 
               count++; 
              if(args.pivotValues[i][j]!= undefined && args.pivotValues[i][j].axis == "value"){ 
                if(j==(args.pivotValues.length-1)) 
                   args.pivotValues[i][j].value=args.pivotValues[i][j].formattedText = sumValue/count;  

                else 
                   sumValue += args.pivotValues[i][j].value; 
             
           
            sumValue =0; 
         
                
        } 
 
 
Please let us know if you have any concerns. 

Regards, 
Scintilla A 


Doug Lenos
Replied On August 20, 2019 03:17 PM UTC

This works perfect!  Thanks for the speedy reply.

Scintilla Arul Jothi Raj [Syncfusion]
Replied On August 21, 2019 04:41 AM UTC

Hi Doug, 
Thanks for the update. Please let us know if you need any further assistance. 
  
Regards, 
Scintilla A 


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