Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Sum() in the If Condition

Hi all,

I was trying to sum the filed grouped by name in the if loop.

=If(Status=1,Sum(Aggr([Amount],Name)))

This is not giving any result.

Can someone please help here

1 Solution

Accepted Solutions
11 Replies
sunny_talwar

May be this:

Sum({<Status = {1}>} Aggr(Only({<Status = {1}>} Amount), Name))

markgraham123
Specialist
Specialist
Author

It's just giving 0 sunny.

sunny_talwar

Would you be able to share a sample?

kkkumar82
Specialist III
Specialist III

Hi

Can you put some dummy data.

Thanks

Kiran Kumar

Anonymous
Not applicable

Hi Mark,

Please try:

Sum(Aggr(Sum({<Status = {1}>} Amount), Name))

markgraham123
Specialist
Specialist
Author

!Here is the sample application..

I was trying to do the calcualtions using the variables.

Anonymous
Not applicable

Hi Mark,'

Only function returns 0(Zero) if they is more than one value for a dimension

Regards

Neetha

sunny_talwar

I see this:

Capture.PNG

markgraham123
Specialist
Specialist
Author

Sunny its working for me.

Also, i'm trying to store the value of the Column's total in chart to a variable...

I can do it by storing the expression in Variabloe.

But due to req. constraints i wanna do it the other way.

Can we do it?