Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of Rows in Pivot Table

DISCLAIMER: I have read a lot of the other solutions out there on getting the sum of rows in a pivot table. After a few hours of trying various solutions, I need to submit here to see if there is something completely unique about my requirement! I can't figure this one out!

I am attempting to get an annualized commission figure based upon how much commission my company has received and how many months have been billed.

My expression for the Annualized Agcy Comm figure calculates properly BY PRODUCT, but I can't get it to total those rows. Here is my expression:

=(Sum({$<IsWon={'true'}>}ProductionCompany_AccrualBalanceCalc))

/

(Count(Distinct{$<IsWon={'true'}>}AccountingMonth))

* 12

Here is a screenshot of my dilemma:

Sum of Rows in Pivot Table.png

Thank you for any help.

1 Solution

Accepted Solutions
whiteline
Master II
Master II

Hi.

It's because your expression is calculated for totals regardless of dimensions, but the months count is different for each row.

Use aggr function to calculate your formula over the chart dimensions explicitly and the Sum() function to get the result.

=Sum(aggr([your expression], [chart dimension1], ...))

View solution in original post

2 Replies
whiteline
Master II
Master II

Hi.

It's because your expression is calculated for totals regardless of dimensions, but the months count is different for each row.

Use aggr function to calculate your formula over the chart dimensions explicitly and the Sum() function to get the result.

=Sum(aggr([your expression], [chart dimension1], ...))

Not applicable
Author

Ahhh, I had the Aggr part right, but I wasn't wrapping the whole expression in a Sum(). Problem solved!