Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

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
Highlighted
Specialist III
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.

Highlighted
Partner
Partner

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

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

Highlighted
Specialist III
Specialist III

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

Highlighted
Specialist III
Specialist III

PFA a little demo app, with your expression working

 

 

Highlighted
Partner
Partner

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.

Highlighted
Specialist III
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.

Highlighted
Specialist III
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])

    )