Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
chriscools
Creator II
Creator II

Only count SKU's where qty on orderlines is greater than zero

Hello,

i want to count all distinct SKU's based on this:

Count(DISTINCT     {<date={">=$(=VDatumSeizoenHuidigVan)<=$(=VDatumSeizoenHuidigTot)"}>}   sku_code          )

that works but it also gives me SKU's that don't have orderlines associated with them.

How should i need to adapt the count formula so that it only counts those SKU's where below qty is greater than zero?

sum (     {<date={">=$(=VDatumSeizoenHuidigVan)<=$(=VDatumSeizoenHuidigTot)"}>}      (qty_unit-qty_unit_cancelled))

Thanx a lot!

 

chris

1 Solution

Accepted Solutions
tresesco
MVP
MVP

You need to put the same condition in set , like:

Count(DISTINCT     {<sku_code={`=sum (     {<date={">=$(=VDatumSeizoenHuidigVan)<=$(=VDatumSeizoenHuidigTot)"}>}      (qty_unit-qty_unit_cancelled))>0` },

date={">=$(=VDatumSeizoenHuidigVan)<=$(=VDatumSeizoenHuidigTot)"}>}   sku_code  )

 

Note, the back quotes in red. You could use another valid quote though.

 

View solution in original post

2 Replies
tresesco
MVP
MVP

You need to put the same condition in set , like:

Count(DISTINCT     {<sku_code={`=sum (     {<date={">=$(=VDatumSeizoenHuidigVan)<=$(=VDatumSeizoenHuidigTot)"}>}      (qty_unit-qty_unit_cancelled))>0` },

date={">=$(=VDatumSeizoenHuidigVan)<=$(=VDatumSeizoenHuidigTot)"}>}   sku_code  )

 

Note, the back quotes in red. You could use another valid quote though.

 

chriscools
Creator II
Creator II
Author

ok, that worked perfectly!

Thanx a lot!!

 

Chris