Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
guestuser
Partner - Contributor
Partner - Contributor

Nested aggregation summation problem

I want to calculate the sum of following expression and display the sum in KPI and also FTM value for it.

But since nested aggregation isn't allowed in Qlik, i'm not able to do so. Anyone please suggest a solution.

 

(if(Sum(a) > Sum(b) ,
if(Sum(c) > Sum(b),
if((Sum(c)-Sum(b)) > (Sum(a)-Sum(b)),
(Sum(a)-Sum(b))*Sum(d),
(Sum(c)-Sum(b))*Sum(d))))

8 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

This looks like it should work.

It isn't a nested aggregation - a nested aggregation is something like a SUM of a SUM - in your expression you're not doing that - you just have some if conditions.

Could it be failing because Sum(a) < Sum(b), or Sum(c) < Sum(b) ? You don't have a calculation defined for either of those conditions.

guestuser
Partner - Contributor
Partner - Contributor
Author

I want to calculate the sum of the given expression as a single object and that isn't working
marcus_malinow
Partner - Specialist III
Partner - Specialist III

ok, so what do you expect to see if Sum(a) < Sum(b) or Sum(c) < Sum(b)?

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Just an FYI - you're missing a closing bracket on your expression

marcus_malinow
Partner - Specialist III
Partner - Specialist III

PFA a little demo app, with your expression working

 

 

guestuser
Partner - Contributor
Partner - Contributor
Author

Thanks for your reply,

My main motive is to display the ftd and ftm value for the expression using KPI chart.

But it isnt showing any value.

marcus_malinow
Partner - Specialist III
Partner - Specialist III

We're not really getting anywhere here.

I'd suggest you upload a small sample app to illustrate the issue, and indicate exactly what results you are looking for.

marcus_malinow
Partner - Specialist III
Partner - Specialist III

To sum the result of your expression you can try using AGGR

Sum(

    Aggr([Your expression], [List of dimensions you want to sum across])

    )