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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count if I have 12 months before the selected

Hi Everyone...

I need to know if a product has been in sold 12 months before the month selected.

For example, my table is:

ProductYear&Month
1201208
1201209
1201210
1201211
1201212
1201301
1201302
1201303
1201304
1201305
1201306
1201307

In this situation if I choose the Year&Month 201307 the product 1 will have the count of 12 months before.

But in some case one month is not in the list, let say 201304 is not in the table, then I will have a count of 11 before if a select the Year&Month 201307.

Can I put this in a expression or script?

Thanks

4 Replies
Not applicable
Author

Can you post an example QVW with the script in?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi gysbert...

Nice example, i think it will be ok with a modification.

how can I get filter the products that just have de 12 months consecutive before.

In other words, When I click the YearMonth just let the products that have the 12 months before in the table.

thanks

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

='Count: ' & count({<YearMonth=,Product={"=count({<YearMonth=,YMNo={'>=$(=max(YMNo)-12)<$(=max(YMNo))'}>}distinct YearMonth)=12"}>}distinct Product)


talk is cheap, supply exceeds demand