Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
vhayward
Partner - Contributor III
Partner - Contributor III

Not expected totals on the pivot table

Hello all,

I have a pivot table with products (y) and wholesalers (x) with percentage-values.
But Qlikview is putting the total on 100%, but it isn't ...

For instance:

ProductWholesaler A
Product A35%
Product B2%
Product C5%
Product D1%
Product E7%
Product E58%
Total100%

It says total 100% at the bottom, where I expected 108%.

What am I doing wrong?

My expression for the percentages are as follow

=

sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=>} [Customer Weight])
/
sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=, [Product Group]=>} TOTAL <"$(=GetCurrentField(Wholesaler))"> [Customer Weight])





Sincerely Yours,
Vincent Hayward

Labels (1)
1 Solution

Accepted Solutions
vhayward
Partner - Contributor III
Partner - Contributor III
Author

I think I have fixed this with the following statement:

=sum(aggr(
sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=>} [Customer Weight])
/
sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=, [Product Group]=>} TOTAL <"$(=GetCurrentField(Wholesaler))"> [Customer Weight]),
[Product Group],
"$(=GetCurrentField(Wholesaler))"
))

Or are there more options to fix this one?

View solution in original post

2 Replies
Not applicable

In straight table, the total is calculated as "total of the expression".

To have the total of the column, you can do like this:

sum

(aggr(value,Dimension))

For you, I think:



sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=>} aggr([Customer Weight],Product))
/
sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=, [Product Group]=>} TOTAL <"$(=GetCurrentField(Wholesaler))"> aggr([Customer Weight],Product))

vhayward
Partner - Contributor III
Partner - Contributor III
Author

I think I have fixed this with the following statement:

=sum(aggr(
sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=>} [Customer Weight])
/
sum( {$<QuarterID={"<=$(=max(QuarterID))>=$(=max(QuarterID)-3)"}, [Year-Quarter]=, [Product Group]=>} TOTAL <"$(=GetCurrentField(Wholesaler))"> [Customer Weight]),
[Product Group],
"$(=GetCurrentField(Wholesaler))"
))

Or are there more options to fix this one?