Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Sum


Hello

I have a requirement to add up the measure (for each row) only if they are +ve.

The underlying data for a catalog 1123CB is as shown below

catalogAreaABCTotal
1123CBPune-80325587
1123CBMumbai170-6515185
1123CBChennai24122-9146

At Qlikview level, I have to display Catalog and Totals only.

Totals for catalog 1123CB should be 87+185+146 = 418

I am using the following formula in Qlikview to achieve this -

if(sum(A) <0, 0, sum(A))) +(if(sum(B) <0,0, sum(B) )) +(if(sum(C) <0, 0, sum(C)))

But the above gives me total of 264 as it does a Sum of Measures A,B,C and then applies for the formula.

How can I achieve this, please advise ?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

sum(rangesum(rangemax(A,0),rangemax(B,0),rangemax(C,0)))


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

sum(rangesum(rangemax(A,0),rangemax(B,0),rangemax(C,0)))


talk is cheap, supply exceeds demand
its_anandrjs

By this you are also get correct result

if(sum(A) < 0, 0, sum(A)) +

if(sum(B) < 0, 0, sum(B)) +

if(sum(C) < 0, 0, sum(C))

Note:- Instead you select Sum of rows from the properties but Rangesum is right way

See snap here:-

Sumrows.png

Hope this helps

Not applicable
Author

Plese find attached application.

Not applicable
Author

Sum of rows - doesnot make any difference.

Rangesum works !

CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

=RangeMax(A,0)+RangeMax(B,0)+RangeMax(C,0)