Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Please sum up the given set analysis expression

HI,

Can anyone let me know how to sum up the below expression:

if (sum({<status={Current}>} if(Store_fiscal='0099' or Store_Retail='0099' or noncomp_fiscal='0099' or noncomp_retail='0099','0', if(Coupon_Flag='Y' and ACCT='MHOODC' or 'QOP.C' ,aggr(sum(Sold_At*Qty*CONV_RATE),Order_Key)-Coupon_Dollars,
if(Coupon_Flag='Y' and ACCT<>'MHOODC' or 'QOP.C' ,aggr(sum(Sold_At*Qty),Order_Key)-Coupon_Dollars,
if(Coupon_Flag<>'Y' and ACCT='MHOODC' or 'QOP.C' ,(Sold_At*Qty*CONV_RATE),
(Sold_At*Qty))))))=0,-sum({<status={Previous}>} if(Store_fiscal='0099' or Store_Retail='0099' or noncomp_fiscal='0099' or noncomp_retail='0099','0', if(Coupon_Flag='Y' and ACCT='MHOODC' or 'QOP.C' ,aggr(sum(Sold_At*Qty*CONV_RATE),Order_Key)-Coupon_Dollars,
if(Coupon_Flag='Y' and ACCT<>'MHOODC' or 'QOP.C' ,aggr(sum(Sold_At*Qty),Order_Key)-Coupon_Dollars,
if(Coupon_Flag<>'Y' and ACCT='MHOODC' or 'QOP.C' ,(Sold_At*Qty*CONV_RATE),
(Sold_At*Qty))))))).When I use a simple at the the very beginning it does not give any values at all.

1 Reply
Not applicable
Author

You have aggregate functions in your expression. You can't sum this expression, because then you would have nested aggreagates [Sum(Sum(Sales))], which is not allowed.

You need to use the Aggr() function. The Aggr() function requires that you define the dimensions over which to aggregate.

Something like:

Sum(Aggr(Your long expression here, Dimension1, Dimension2))