Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Dashboard Dates

Hi Community

I have a field "Budget Month", which takes the year, then the month from the 26th to the 25th of the following month e.g my current budget month is "2016 Jan - Feb" and before the 26th it was "2016 Dec - Jan" for dates that fall in Jan and "2015 Dec - Jan" for dates that fall in Dec. Now I would like to get the previous budget month. This must change dynamically as I make date selections and as time goes

Currently it only works correctly when I have a date selected and I would like it to work exactly as my current budget month. Can anyone please assist?

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

I suggest that you add something like the following fields to your master calendar:

MasterCalendar:    

LOAD

     CalDate As Date,

     ...         

     If(Day(CalDate) <= 25, Date(CalDate, 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 1), 'MMM'),

          Date(AddMonths(CalDate, 1), 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 2), 'MMM')) As Period,

     AutoNumber(If(Day(CalDate) <= 25, Date(CalDate, 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 1), 'MMM'),

          Date(AddMonths(CalDate, 1), 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 2), 'MMM'))) As PeriodSeq,

     ...

(Assumes you have a master calendar load. Adjust the script to change CalDate to the base date in your calendar)

Now you can find the previous period using =PeriodSeq - 1

If you don't have a master calendar, you can search this site for more information

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I suggest that you add something like the following fields to your master calendar:

MasterCalendar:    

LOAD

     CalDate As Date,

     ...         

     If(Day(CalDate) <= 25, Date(CalDate, 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 1), 'MMM'),

          Date(AddMonths(CalDate, 1), 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 2), 'MMM')) As Period,

     AutoNumber(If(Day(CalDate) <= 25, Date(CalDate, 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 1), 'MMM'),

          Date(AddMonths(CalDate, 1), 'YYYY MMM') & ' - ' & Date(AddMonths(CalDate, 2), 'MMM'))) As PeriodSeq,

     ...

(Assumes you have a master calendar load. Adjust the script to change CalDate to the base date in your calendar)

Now you can find the previous period using =PeriodSeq - 1

If you don't have a master calendar, you can search this site for more information

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thanks a lot Jonathan! This works perfectly