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: 
Tatum1981
Contributor II
Contributor II

Count Distinct

 I  am trying to write a formula to bring back the distinct sku count for a specific year.  If I just do a count(distinct I get counts for anything that is in the data set even if it is years old.  I am trying to compare one year's sku count to another.  I found that count(distinct if ( (ZINVSLS)>1,Material)) returns the correct value if I select a certain year but when I try count(distinct if (sum({<Year={'2020'}>}(ZINVSLS)>1), Material)) I get an error.  I want my expression to calculate sku count for a specific year.

1 Solution

Accepted Solutions
Dalton_Ruer
Support
Support

How about     

Count(  IF(  ZINVSLS >1 and Year='2020',  Material )

View solution in original post

2 Replies
Dalton_Ruer
Support
Support

How about     

Count(  IF(  ZINVSLS >1 and Year='2020',  Material )

Tatum1981
Contributor II
Contributor II
Author

That works!  Thank you so much!