Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic Months

I want last two months of data in dimension

how to write calculation condition 

5 Replies
Ralf_Heukäufer
Partner - Creator III
Partner - Creator III

Hello,

you can try

if((yourmonthvariable = month(today()) or yourmonthvariable = month(today()) -1) , yourmonthvariable)

But you must have select the actual year in filter for that

Anonymous
Not applicable
Author

Actually you have to add a Calculated Dimension, Try this:

aggr(only({<Date={">=date(monthstart(today(),-6))"}>} MonthYr),MonthYr)

Anonymous
Not applicable
Author

I have date column and I want last two months in calculated dimension

Anonymous
Not applicable
Author

Qlik dont work well creating calculated dimensions in Chart, so, use it just in an specific case. The best way is to create it on Script,  for example:

LEFT JOIN (Calendar) LOAD

MonthYr,

MonthYr as Last6Mos

RESIDENT Calendar

WHERE Date >= monthstart(today(),-2);

Ralf_Heukäufer
Partner - Creator III
Partner - Creator III

If you use Monthstart you must subtract the number of days so it is not -2 but something like -60.