Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Grand Totals Calculation

Answered
Isaac asked on March 13, 2020

Hello,
 
There is a functionality that our client is asking and we don’t know if it’s possible to obtain using Flexmonster Pivot table.
We are having troubles to obtain correct total values.
 
The following example shows the current results and the expected results:
 
See the attached file.
 
 
Is there any configuration that allows custom total calculation?
Can we obtain the expected results using another configuration?
 
Here is a link to the example using Flexmonster Pivot Table:
https://jsfiddle.net/dgh8ka3r/
 
Thank you,

Attachments:
grand_totals.PNG

1 answer

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 13, 2020

Hello, Isaac,
 
Thank you for reaching out to us.
 
In order to achieve the desired functionality, we recommend getting on with calculated values.
 
The feature allows adding a measure that will be based on specified measures and displayed on the grid. Such measures are calculated on the client-side; therefore they are not present within the initial data set.
 
In your case, the “Vol Chg” hierarchy should be a calculated measure. It can be added to the report, as shown in the following code snippet:

"measures": [{
  ...
  },
  {
      "uniqueName": "Vol Chg",
      "formula": "(sum(\\"Curr Vol\\") - sum(\\"Prev Vol\\")) / sum(\\"Prev Vol\\")",
      "caption": "Vol Chg"
  }
]

Moreover, it should be removed from the data set passed to the component:

return [{
    "Customer": "A",
    "Product": "P1",
    "Curr Vol": 10,
    "Prev Vol": 40,
    "Vol Chg": -0.75
  },
  ...
]

 
We have modified the JSFiddle you have provided us with in the way it uses calculated values in order to implement the described functionality.
 
You can find detailed information about calculated values and the tutorial dedicated to managing them in our documentation.
 
We hope it works for you.
 
Do not hesitate to contact us in case additional questions arise.
 
Best regards,
Illia

Please login or Register to Submit Answer