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

QuestionQuestion

I'm trying to write an if statement to only show Quarantined Inventory. Wanting to separate it from the total inventory count. I'm either getting an 0 or a number higher than my current inventory count. Below is my current if statement and how I populate inventory. Any and all help will be most welcomed.

If( [InvHistory Transaction Type] = 'Quarantined' , $(InventoryQuantity) , 0)

sum({$< [Inventory Date] = {"<=$(=date(max(Date)))"},
Year={*},
Period={*},
Date={*},
Month={*},
[Calendar Year] = {*},
[Inventory Status Code] -= {1},
[LinkId]={"INVHSTD"}
>}
[InvHistory Transaction Quantity])

3 Replies
johnw
Champion III
Champion III

Perhaps just add this to your set expression?

[InvHistory Transaction Type]={'Quarantined'},

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Just to clarify John's response - you can't ask this question outside of your sum(). Instead, you should either ask it inside the SUM(), or better off, add it as another filter in your set analysis condition.

cheers,

Oleg Troyansky

Learn advanced Qlik techniques in my book QlikView your Business

Not applicable
Author

Thank you guys for helping. This is how I solved it. Used      [Inventory Quarantined] ={'Quarantined'},     .

sum({$< [Inventory Date] = {"<=$(=date(max(Date)))"},
Year={*},
Period={*},
Date={*},
Month={*},
[Calendar Year] = {*},
[Inventory Status Code] -= {1},
[Inventory Quarantined] ={'Quarantined'},
[LinkId]={"INVHSTD"}
>}
[InvHistory Transaction Quantity]