Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

pthomas3253
New Contributor II

Rolling 12 for date Dimension

  I've got a date dimension and I'd like to limit that dimension to a rolling 12 view instead of all of the dates available.

I have a variable that I have created vMaxDate12 which is

=addmonths(Date(Max([ROLLING_DATA.Date.autoCalendar.Date]),'YYYY-MM-DD'),-11)

I'd like to set up a dimension to be: IF(AS_OF={'$(>=(vMaxDate12)'},AS_OF) and I keep getting an invalid dimension. Any help would be greatly appreacited!

4 Replies

Re: Rolling 12 for date Dimension

Try this for your variable....

=AddMonths(Max(TOTAL [ROLLING_DATA.Date.autoCalendar.Date]), -11)

DavidŠtorek
Contributor III

Re: Rolling 12 for date Dimension

Hi Patricia,

first think I would suggest is that there is some garbage in your  expression. You are mixing if statement and set expression. Try it like this:

IF(AS_OF>=$(vMaxDate12),AS_OF)

pthomas3253
New Contributor II

Re: Rolling 12 for date Dimension

Thk you, Sunny - I've updated the Variable to be as above. However - still not getting what I'm trying to with limiting the dates to only 12 months.

pthomas3253
New Contributor II

Re: Rolling 12 for date Dimension

=IF([ROLLING_DATA.Date.autoCalendar.Date]>=vMaxDate12,[AS_OF])

This worked for me!

Community Browser