Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kohli
Creator II
Creator II

Create a variable for max month start date and end date

I have to create a variables for start date and end date for max month in a table, and last year same month start date and date.

Ex: I have table with 01-01-2017 to 31-03-2018. i have to create the variables for fetch the data from 01-03-2018 to 31-03-2018 and 01-03-2017 and 31-03-2017. (Compare current month and last year same month)

Labels (1)
1 Reply
Gysbert_Wassenaar

One variable can have only one value. So if you want four different values then you need four different variables:

vStartDateCurrentYear: =MonthStart(Max(MyDateField))
vEndDateCurrentYear: =MonthEnd(Max(MyDateField))
vStartDateLastYear: =MonthStart(Max(MyDateField),-12)
vEndDateLastYear: =MonthEnd(Max(MyDateField),-12)


talk is cheap, supply exceeds demand