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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
matthewp
Creator III
Creator III

Defauly selection trigger - previous + current year minus current month

I want to create a sheet trigger to select the previous year and the current year but not the current month.

Sample data is as follows

Year month

201511

201512

201601

201602

201603

201604

Selection I would want would be

201511

201512

201601

201602

201603

17 Replies
sunny_talwar

What is the logic here to exclude everything before 201412? Only show this year (except current month) and complete previous year?

I would recommend changing number to date using date#() function in the  script

Not applicable

In the trigger,

use select in field

Field : Year month

Search String : ='<=' & Date(max([Year month]),'YYYYMM')

Regards,

Anjali Gupta

matthewp
Creator III
Creator III
Author

yeh thats the logic

i was thinking..

='<' & Max([Year period]) & > left(Max([Year period]), 4) - 2

sunny_talwar

Try this:

='<' & Max(YearMonth) & '>=' & Num#(Date(YearStart(Max(Date#(YearMonth, 'YYYYMM')), -1), 'YYYYMM'), '##')

matthewp
Creator III
Creator III
Author

How would i do this for actual dates?

Month

Jan-15

Feb-15 etc

same logic

i tried ='<' & Max(Month) & '>=' =year(Month)-2

sunny_talwar

Something like this:

='<' & Date(Max(Month), 'MMM-YY') & '>=' & Date(YearStart(Max(Month), -1), 'MMM-YY'), '##')

matthewp
Creator III
Creator III
Author

Something missing i think

Garbage after expression','

='<' & Date(Max(Month), 'MMM-YY') & '>=' & Date(YearStart(Max(Month), -1), 'MMM-YY'), '##'

sunny_talwar

My bad, just this:

='<' & Date(Max(Month), 'MMM-YY') & '>=' & Date(YearStart(Max(Month), -1), 'MMM-YY')