Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select if count is zero

Hi,

I would like to be able to select customers that has purchased no products in year 2012. How is that possible? I have a list box with expression =Aggr(Count(DISTINCT Product),CUSTOMER_ID) but it doesn't work...

Capture.PNG.png

1 Solution

Accepted Solutions
sudeepkm
Specialist III
Specialist III

Please see the attachment here the year is dynamic.

Based on the year selected it will display the customers if no selections or more than one years selected then it will display the customer (who did not buy product) in max year. you can similarly use it for other dimensions.

View solution in original post

9 Replies
ali_hijazi
Partner - Master II
Partner - Master II

Check attached

I can walk on water when it freezes
Not applicable
Author

Is there any more general method?

If I want to do same selection across year 2012 and Team B or I something more complex?

Count(distinct {<CUSTOMER_ID=E({<YEAR={2012}>} CUSTOMER_ID)>} Product)

ali_hijazi
Partner - Master II
Partner - Master II

add your conditions to the E function in the set analysis as usual

I can walk on water when it freezes
sudeepkm
Specialist III
Specialist III

Please take a look at the attachment. I've a straight table created that will show the list of customer not purchased product during 2012.

Not applicable
Author

I hoped there would be some syntax that would use current selections (select year 2012 and after that select "0 meetings") instead of hard coding each year (and other required dimensions). But maybe I can work something out with  your examples.

Thanks!

ali_hijazi
Partner - Master II
Partner - Master II

you can create a variable and set it from the UI and use this variable inside the set analysis

I can walk on water when it freezes
Not applicable
Author

That starts to sound right. Would you have any example how to do that?

sudeepkm
Specialist III
Specialist III

Please see the attachment here the year is dynamic.

Based on the year selected it will display the customers if no selections or more than one years selected then it will display the customer (who did not buy product) in max year. you can similarly use it for other dimensions.

Not applicable
Author

Excellent! Thank you!

I didn't know you can use selected dimensions like that through variables.