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

Announcements
Mastering Change Data Capture: Read Now
cancel
Showing results for 
Search instead for 
Did you mean: 
psk180590
Creator III
Creator III

Totals in Pivot Table

Hello All,

I have recently encountered a problem with the Totals in my Pivot Table(Show Partial Sums).

Below is my Expression which calculates Sum(Quantity) for various Dimensions:

if(vBillNum=1, count({<Flag_Actionspaket={'1'}>} distinct %Key_Header),sum({<Flag_Actionspaket={'1'}>}Quantity)).

But, the Sum displayed in Pivot Table varies from Dimension to Dimension.

I have already learnt about using the Aggr function, but not sure how and where to implement in my case. Could some one throw some light into this topic.

TIA!!

1 Solution

Accepted Solutions
stabben23
Partner - Master
Partner - Master

If you start an Expression in pivot With if, then a total will not get calculated.

you need to wrap a sum around Your Expression and probably a aggr function.

sum(if(vBillNum=1, count({<Flag_Actionspaket={'1'}>} distinct %Key_Header),sum({<Flag_Actionspaket={'1'}>}Quantity)))

or

sum(aggr(if(vBillNum=1, count({<Flag_Actionspaket={'1'}>} distinct %Key_Header),sum({<Flag_Actionspaket={'1'}>}Quantity)),Dimensionfields))

View solution in original post

2 Replies
stabben23
Partner - Master
Partner - Master

If you start an Expression in pivot With if, then a total will not get calculated.

you need to wrap a sum around Your Expression and probably a aggr function.

sum(if(vBillNum=1, count({<Flag_Actionspaket={'1'}>} distinct %Key_Header),sum({<Flag_Actionspaket={'1'}>}Quantity)))

or

sum(aggr(if(vBillNum=1, count({<Flag_Actionspaket={'1'}>} distinct %Key_Header),sum({<Flag_Actionspaket={'1'}>}Quantity)),Dimensionfields))

psk180590
Creator III
Creator III
Author

Thanks Staffan,

The second option with Aggr suits my requirement.