Qlik Community

Qlik Sense Cloud Discussions

New Contributor III


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



3 Replies
Contributor III

Re: SetAnalysis

Try this

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


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


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)


=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