Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

Help with if sum

Hello,

I have this expression:

=if (Val='a',Sum(Aggr(if(inv='AR000111',sum(Amount)+ 53165,sum(Amount)),inv))  ,sum(Amount_B) ) (Works Fine)

I want to sum this

Sum(Aggr(if(inv='AR000112',sum(Amount)+ 55900,sum(Amount)),inv))

I have tried with "AND" and "OR" But is not working.

Thanks!

1 Solution

Accepted Solutions
veidlburkhard
Creator III
Creator III

Hi Pablo,

this should do it:


=if (Val='a',Sum(Aggr(if(inv='AR000111',sum(Amount)+ 53165,

If(inv='AR000112',sum(Amount)+ 55900,sum(Amount))),inv))  ,sum(Amount_B)


Burkhard

View solution in original post

3 Replies
veidlburkhard
Creator III
Creator III

Hi Pablo,

this should do it:


=if (Val='a',Sum(Aggr(if(inv='AR000111',sum(Amount)+ 53165,

If(inv='AR000112',sum(Amount)+ 55900,sum(Amount))),inv))  ,sum(Amount_B)


Burkhard

martynlloyd
Partner - Creator III
Partner - Creator III

AND and OR are boolean operators within the condition test,

as BV explains, what you need is the IF - ELSE  construct, in QlikView the Else is the comma after the do-this-if-true part of the statement.

pgalvezt
Specialist
Specialist
Author

Thanks Burkhard