Can we add sub-total columns based on other columns, but repeated (same type of calculation but based on addition of other columns)?

Answered
Jason asked on March 28, 2023

Can we add sub-total columns based on other columns, but repeated (same type of calculation but based on addition of other columns) in the pivoted view?
In other words, instead of adding one new sub-total/calculated column, we create a sub-total that takes 2 other columns and have this calculation repeat in several other parts (same type of calculation but with different input columns)

5 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster March 29, 2023

Hello, Jason!
 
Thank you for contacting us.
 
Kindly note that it is possible to create a calculated measure with a custom formula as follows:

measures: [{
          uniqueName: "Price",
          aggregation: "sum"
        },
        {
          uniqueName: "Discount",
          aggregation: "sum"
        },
        {
          uniqueName: "Calculated field",
          formula: "sum('Price')+sum('Discount')",
          caption: "Sum(Price+Discount)"
        }
]

We have prepared a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/06db274r/.
You can read more about the calculated values in our docs: https://www.flexmonster.com/doc/calculated-values/.
 
There are also built-in Running Totals aggregations, which might be useful for your use case. You can read more about mentioned aggregations in the following article: https://www.flexmonster.com/blog/running-totals-in-pivot-grid/.
Please note that from 2.8.7 version of Flexmonster the Running totals aggregation described in the article is split into two different aggregations: Running Totals of Column and Running Totals of Row.
 
Hope you will find our answer helpful.
 
Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster April 6, 2023

Hello, Jason!

Hope you are doing well.

Our team is wondering if you had a chance to look through our previous response. Could you please let us know if the calculated values approach works for your case?

Looking forward to hearing from you.

Regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster April 13, 2023

Hello, Jason!

Hope you are having a great week.

Just checking in to ask if the calculated values approach works well for your case.

Looking forward to hearing your feedback.

Kind regards,
Solomiia

Public
Jason April 13, 2023

I think this would work, thank you!

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 14, 2023

Hello, Jason,

Thank you for the feedback.

We are glad to hear that it works for you. As always, you are welcome to reach out to us in case other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer