Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
ljackson
Creator
Creator

Should I use an 'if/and' expression?

Good afternoon everyone.

I am struggling to write an expression that has two conditions.

I have dimensions 'OrderSentqtyD' and 'ActWsvD'.

I need to sum the OrderSendqtyD, but excluding records where the OrderSendqtyD is -1 or less AND the ActWsvD equals zero.

So far I have been using the following expression successfully to exclude records with OrderSentqtyD -1 or less, but am unsure how to add the new condition of a zero ActWsvD:

 

Sum({$<OrderSentqtyD*={">-1"}>}OrderSentqtyD)

I have tried the following, but the results all come out with 0.

Sum({$<OrderSentqtyD*={">-1"},ActWsvD={"0"}>}OrderSentqtyD)

Do I need an 'if/and' expression?  If so, how should it be set out?

Thank you all in advance, your help is greatly appreciated.

Leah

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

So

Sum({$<OrderSentqtyD*={">-1"},ActWsvD-={"0"}>}OrderSentqtyD) should return what you want

View solution in original post

5 Replies
Clever_Anjos
Employee
Employee

Do you want include or exclude AcdWsvD = 0?

Sum({$<OrderSentqtyD*={">-1"},ActWsvD={"0"}>}OrderSentqtyD)  //include

Sum({$<OrderSentqtyD*={">-1"},ActWsvD-={"0"}>}OrderSentqtyD) //exclude

ljackson
Creator
Creator
Author

Just to clarify, If the record has both a negative OrderSentqtyD AND a zero ActWsvD, I need the record excluded.

(if it has negative OrderSentqtyD and ActWsvD above zero it has to be included, and vice versa if the OrderSentqty is positive and ActWsvD is zero it needs to be included.   I only want the exclusion when both conditions apply to a record).

Hope this helps.

Clever_Anjos
Employee
Employee

So

Sum({$<OrderSentqtyD*={">-1"},ActWsvD-={"0"}>}OrderSentqtyD) should return what you want

ljackson
Creator
Creator
Author

Perfect, thank you!

Clever_Anjos
Employee
Employee

you´re welcome