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: 
Not applicable

Sum If Problem

Hi all

Hope someone can help me with this, probably easy question, but I'm a beginner [:)]

I'm trying to get sum of salesprice if a number of conditions are present.

The first expression seems to get the right sum, but when I want to apply a condition more I can't seem to get the right result.

Sum(if(Invoicestatus='Accept' and Invoicetype='Debet'or Invoicetype='Kredit', [Slv Salesprice]))

This seems to get the result I want here, but then I want to only get the sum where also field 'Vgr' are between 010 & 800

But I can't seem to get it right

Field Vgr have entry's from 010 to 999

Thanks

Niels

2 Replies
Not applicable
Author

Hi,

If i understood your question properly,below is the solution.

Sum(if(Invoicestatus='Accept' and Invoicetype='Debet'or Invoicetype='Kredit' and (Vgr>=010 and Vgr<=888), [Slv Salesprice]))

You could also write the same expression in Set analysis.

Sum({<Invoicestatus={'Accept'},Invoicetype={'Debet','Kredit'},VGR={">=010<=888"}>}[Slv Salesprice])

Hope this helps you.

- Sridhar


tseebach
Partner - Creator III
Partner - Creator III

Hi,

I think you need to nest your control statements correct, notice the extra parenthesis:

Sum(if( (Invoicestatus='Accept' and Invoicetype='Debet') or Invoicetype='Kredit', [Slv Salesprice]))