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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
lorenwood
Contributor III
Contributor III

Maximum Sum of Dimensions - Aggregation


Hello all, wanted to know if anyone can help with this issue: I have a table see below:

PayerRestrictionsTypeVolume
ANActual300
ANActual500
AYPreferred200
BNActual300
BYPreferred200
BYPreferred500

What I need to calculate is based on the  highest sum of the volume , show only associated dimensions with the highest sum of volume at that level:

So for Payer A , the result should be Volume =800 and Restrictions = 'N' and Type = 'Actual'

For Payer B, the result should be Volume = 700 and Restrictions = 'Y' and Type ='Preferred' so the end result should look something like this:

PayerRestrictionsTypeVolume
ANActual800
BYPreferred700

Is there any way to accomplish this in an expression in a straight table?

Any help would appreciated !

Thanks

Loren

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached qvw


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
whiteline
Master II
Master II

Hi.

If you need the expression you can start from that one:

=if(Sum (Volume)>Sum (total<Payer>Volume)/2, Sum (Volume))

It works for the sample provided, but I guess you real data are more complex.

Also consider calculating the flag that the row is relative to the highest sum of the volume in script.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached qvw


talk is cheap, supply exceeds demand