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: 
Not applicable

Partial sums incorrect

Monthname

toyBallsBatsDollsBikesTotal
Excel totals
January 143572127246
248
February 10224338167
167
March 10633230170
171
April 9616423139
139
May 99222726174
174
June 8813124126
126
July 12025831184
184
August 451421677
77
September 71174228158
158
October 51112417103
103
Total 9212321342601544










excel totals
921232134260


Dear All,

Ive created a very simple pivot which shows the amount of toys bought over the course of a year or year to date.

using 1 dimension - monthname

and 1 expression  - count(distinct toy)

All of the internal figures in the table are correct and the sub totals at the bottom in the row 'Total'  are also correct but as the sub totals read across the table they calculate incorrectly, seen by coumn 'Total'

the additional column and row excel totals, ive added to show the differences.

this table has no 'If' statement and there are no synthetic keys in any table but im confused as to why certain partial sums are showing/ adding incorrectly, can anyone shed any light.

sorry but i cant add the qvw as its part of a larger company sheet

many thanks

1 Solution

Accepted Solutions
sureshbaabu
Creator III
Creator III

Hello,

I faced the same issue today and I found the solution for the same.

I'm not sure if you have fixed the issue already. Thought it can help you

The incorrect total is beacuse of the duplicate records in the data.

The pivot table will not show these records more than once, but they will all be included in the sum.

Solution: we have to use the aggregator function (‘aggr’) to create correct partial sums

Syntax:  Sum(Aggr(original expression,Dimension1,Dimension2))

For your example:  Sum(Aggr( count(distinct toy),monthname))

Let me know if that works for you!!!

Thanks

View solution in original post

3 Replies
sureshbaabu
Creator III
Creator III

Hello,

I faced the same issue today and I found the solution for the same.

I'm not sure if you have fixed the issue already. Thought it can help you

The incorrect total is beacuse of the duplicate records in the data.

The pivot table will not show these records more than once, but they will all be included in the sum.

Solution: we have to use the aggregator function (‘aggr’) to create correct partial sums

Syntax:  Sum(Aggr(original expression,Dimension1,Dimension2))

For your example:  Sum(Aggr( count(distinct toy),monthname))

Let me know if that works for you!!!

Thanks

Not applicable
Author

Hi Suresh

Yes that worked thank you. I thought it may be a duplicate issue , hence the distinct count. Im curious why the figures went up when the correct equation was put in.

If the distinct figures are not in the pivot but are in the totals , wouldnt the totals be higher than what the actual figures are.

Despite not understanding why the figures went up I am thankful its adding correctly now

sureshbaabu
Creator III
Creator III

Hello,


I had gone thorough some discussion and the following could be the reason.


Pivot tables don't do a sum of rows, but rather re-evaluate your expression for the total row. When doing the full total- the expression will be applied for the total column and it provided the results.

Hope this clarifies your question.

Thanks