Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
YHC
Contributor II
Contributor II

Incorrect Sum in Pivot Table

Hi All,

My problem is I am getting the wrong total count in the pivot table. The total in the right is performed by pivot, and the total in the left is the selected column, they should be the same when the outcome is correct, but the values from pivot are different from the original table.
There's no duplicates value.

Could someone tell me where I'm going wrong? Following are the attached screenshots.

Thanks!

 

Labels (2)
1 Solution

Accepted Solutions
mageste
Partner - Contributor III
Partner - Contributor III

Hi!

It seems like the expression sums the same row multiple times. Actually, you can see that every value in the expression (on the right) is equal to 24 times the value from the original table (on the left).

My guess is that you have 24 different Product IDs and the SUM expression is calculating for repeated rows. 

If it is the case, maybe just editing it to "SUM(DISTINCT FCCY_AMOUNT)" will solve it.

If not, you can try an aggr expression like "SUM(AGGR(SUM(FCCY_AMOUNT), PRODUCT))"

View solution in original post

2 Replies
mageste
Partner - Contributor III
Partner - Contributor III

Hi!

It seems like the expression sums the same row multiple times. Actually, you can see that every value in the expression (on the right) is equal to 24 times the value from the original table (on the left).

My guess is that you have 24 different Product IDs and the SUM expression is calculating for repeated rows. 

If it is the case, maybe just editing it to "SUM(DISTINCT FCCY_AMOUNT)" will solve it.

If not, you can try an aggr expression like "SUM(AGGR(SUM(FCCY_AMOUNT), PRODUCT))"

YHC
Contributor II
Contributor II
Author

It works, thanks for solving!