Search code examples
qlikviewqliksenseset-analysisqlik-expression

QlikView Default 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.

If for example we were in 201604...

Sample data is as follows:

201511

201512

201601

201602

201603

201604

Selection I would want would be:

201511

201512

201601

201602

201603

Solution

  • In the Trigger expression you can use the YearStart function along with the MAX function to get all of the previous year plus the current years months excluding the current month.

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