Qlik Community

Qlik Sense Cloud Discussions

sirivikram1506
New Contributor III

SetAnalysis

Hi all ,

i would like to use two aggr functions in set anaysis at one statement like

Smiley Sad{<Year={2016},CurrentStatus={TXNS}>}sum(AmountUSD)/count(UBID))

but it is showing error pls help to make correct

thanks,

vikram

3 Replies
kenphamvn
Contributor III

Re: SetAnalysis

Try this

SUM({<Year={2016},CurrentStatus={'TXNS'}>} AmountUSD)

/

Count({<Year={2016},CurrentStatus={'TXNS'}>} UBID)

MVP
MVP

Re: SetAnalysis

If the previous suggestion works for you, then use it. If the overall sums do not give the correct result, then you may need something like

=Sum({<Year={2016},CurrentStatus={TXNS}>} Aggr(Sum(AmountUSD)/Count(UBID) ....))

(where ... is a comma separated list of the chart/table dimensions)

or

=Sum(Aggr(Sum({<Year={2016},CurrentStatus={TXNS}>} AmountUSD)/Count({<Year={2016},CurrentStatus={TXNS}>} UBID) ....))

Re: SetAnalysis

I think one of the above two solution should work for you, but the point to note here is that set analysis can only be used within a aggregation function such as Sum, Max, Min, Avg, Mode, Median... etc... in your case you just added set analysis before your aggregation function which is not the right syntax....

The correct syntax goes like this

Sum({<Set Analysis>}AmountUSD)/Count({<Set Analysis>}UBID)

Also, read more about set analysis here:

A Primer on Set Analysis

Community Browser