Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

1 Solution

Accepted Solutions
sunny_talwar

Try this:

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

View solution in original post

17 Replies
richard_chilvers
Specialist
Specialist

Hi Matthew

One idea might be to have 2 actions in your trigger:

First - select the current month in the appropriate field

Second - SELECT EXCLUDED

HTH

sunny_talwar

Select everything except the most recent month? May be something like this:

='<=' & Date(AddMonths(Max(YearMonth), -1), 'YYYYMM')

matthewp
Creator III
Creator III
Author

So select previous year and the current year

and

SELECT excluded current month?

makes sense

sunny_talwar

Attached a sample with on open trigger

matthewp
Creator III
Creator III
Author

This selects every single year month, possibly because year month is a string not a date?

sunny_talwar

Including the most recent one?

matthewp
Creator III
Creator III
Author

yes 201603

maybe because it is a string not a date?

even thought max should still work as is it technically still the MAX number

richard_chilvers
Specialist
Specialist

Trigger action one will select only the current month.

Trigger action two reverses the selection, and therefore excludes the current month.

Might work - but I haven't tried it.

matthewp
Creator III
Creator III
Author

='<' & Max([Year period])

selects everything except 201603

so just need to use that and exclude anything thats 201412 backwards