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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
sodavid
Contributor II
Contributor II

Sum with multiple conditions

Dear Qlik Community,

I am new to Qlik sense and currently trying to sum with condition. I have a sample equation where I am trying to sum qty by multiple conditions.

My result is incorrect with Sum(if([TRACKINGSTATUS]='1', '8' and [DELETEDBY]='0', [QTY])).

I want to sum Qty if TRACKINGSTATUS ='1' & '8' and DELETEDBY =0 or alternatively use variable function.

 

Expected result  in Chart = 10 for 2018 and 50 for 2022.

 

Thanks in advance.

 

Samson O'David

Labels (4)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master II
Partner - Master II

Try this;

SUM({<[TRACKINGSTATUS]={'1','8'},[DELETEDBY]={'0'}>}[QTY])

View solution in original post

4 Replies
vidyutverma
Partner - Contributor III
Partner - Contributor III

As you see Tracking Status is numeric, so to compare two such numbers, 1 & 8 you need to do two such comparisons:

If (([TrackingStatus=1 Or TrackingStatus= 😎 and [Rest of the comparison])

sodavid
Contributor II
Contributor II
Author

Thanks for your response, however the result is still incorrect

Sum(if([TRACKINGSTATUS]='1',[TRACKINGSTATUS]= '8' and [DELETEDBY]='0', [QTY]))

BrunPierre
Partner - Master II
Partner - Master II

Try this;

SUM({<[TRACKINGSTATUS]={'1','8'},[DELETEDBY]={'0'}>}[QTY])

sodavid
Contributor II
Contributor II
Author

Awesome. Thanks!