Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
gertjanvanluik_
Contributor
Contributor

SET Analysis Possible or Exclude

Hi all,

I have a question about SET Analysis with the Possible or Exclude function. I've a set of sales per month.  Each month a set of products. I want to know how many products I sold in previous period, but NOT in the current period. So I want to use the Exclude function. When I want to know how many products are not sold in Period 2, I use this code:

count( distinct {$< Product = E( {$< Month = {2} >} ) >} Product )

 But I want this for a rolling year. In period 2 I want to compare it with period 1, in period 3 with period 2 etc.

Pls. can you help me?

Labels (2)
2 Replies
GaryGiles
Specialist
Specialist

Try this:

count({$<Year={$(=Year(AddMonths(Today(),-1)))},Month={$(=num(month(AddMonths(Today(),-1))))},
Product=E({$<Year={$(=Year(Today()))},Month={$(=Num(Month(Today())))}>} Product)>} distinct Product)

You need to use the Addmonths with Year() and Month() to account for December to January.

gertjanvanluik_
Contributor
Contributor
Author

Hi @Anonymous,

Thank you for your solution. This is not were I was looking for. I want a solution where I have a table with dimension month and then every month the missing products in that month, compared with the previous month.

Look at my attachment for a the model.