Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtotal is not same as the summation of individual rows of Pivot table

Hi,

In my calculation I have used the formula as IBPrevYrAdj = (1+((PartA Ratio/Part B Ratio) - 1)) * Filtered BO.

Here, the total at USA level in "IBPrevYrAdj" column is not same as the summation of all individual countries of USA i.e. sum of IS EAST+ IS Midwest... and so on after applying the formula.

Is there any way, I can have the subtotal of USA same as the summation of all individual countries in column IBPrevYrAdj.

    

ClusterCountryL2CountryIBPrevYrAdjAdj RatioFiltered BOPart A RatioPart B Ratio
AMERICASUSATotal2,124,106.691.052,028,790.9749,250,247.0047,040,225.00
AMERICASUSAIS EAST470,125.211.01466,662.978,784,427.008,719,734.00
AMERICASUSAIS MIDWEST439,876.371.02431,956.439,665,635.009,491,606.00
AMERICASUSAIS SOUTH569,848.491.05542,449.0411,062,249.0010,530,354.00
AMERICASUSAIS WEST421,749.431.03408,879.008,973,982.008,700,125.00
AMERICASUSAMEXICO106,197.601.04102,444.251,694,475.001,634,587.00
AMERICASUSAOTHERS100,171.601.3176,399.291,195,626.00911,885.00
AMERICASUSAPCMS USA0.000.85-2,081,459.002,449,643.00
AMERICASUSAULTRASOUND FIELD SERVICE0.001.26-5,792,394.004,602,291.00
IBPrevYrAdj = (1+((PartA Ratio/Part B Ratio) - 1)) * Filtered BO
1 Solution

Accepted Solutions
Not applicable
Author

Hi Swuehl,

Thanks for the reply.. It worked for me.

View solution in original post

2 Replies
swuehl
MVP
MVP

In the pivot table, the total will be calculated as expression total, like evaluating the expression in a text box.

If you want sum-of-rows in the pivot total, you need to use advanced aggregation (search for sum-of-rows in pivot tables in the HELP), something like

=Sum( Aggr( YourIBPrevYrAdjExpressionComesHere, Cluster, CountryL2, Country))

edit: And you can't reference other expression labels like "Part A Ratio" within the aggr() expression, you need to write the full code.

Not applicable
Author

Hi Swuehl,

Thanks for the reply.. It worked for me.