Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
jaymerry
Creator
Creator

24 rolling Months from YYYYMM format

Hello all,


I'm trying to calculate directly and dynamically into a chart the 24 rolling Months.

My time dimension has the following format : YYYYMM.


Have you ever calculated this kind of dimension ?

I tried to use the "Makedate" function, without success.


Thank you for your help,


Best Regards,


Jaymerry

1 Solution

Accepted Solutions
jaymerry
Creator
Creator
Author

Thank you Jagan,

I have found the following way, which works in my chart :

YEAR(addmonths(Makedate(left(%YYYYMM,4),right(%YYYYMM,2)),-24,1))&right(left(addmonths(Makedate(left(%YYYYMM,4),right(%YYYYMM,2)),-24,1),5),2)

Best Regards,

Jaymerry

View solution in original post

4 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

If you have date field in your datamodel, then use the following expression

=Sum({<YearDimension=, MonthDimension=, QuarterDimension=, DateDimension={'>=$(=MonthStart(Max(DateDimension), -23))<=$(=MonthEnd(Max(DateDimension)))'}>} MeasureName)

Exclude Year, Month, Quarter dimensions in the expression as in the above expression.

Hope it helps you.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Hi,

You can arrive a date by using MakeDate() as below

=MakeDate(Left(DateDimension, 4), Num(Right(DateDimension, 2)), 1)

Regards,

Jagan.

jaymerry
Creator
Creator
Author

Thank you Jagan,

I have found the following way, which works in my chart :

YEAR(addmonths(Makedate(left(%YYYYMM,4),right(%YYYYMM,2)),-24,1))&right(left(addmonths(Makedate(left(%YYYYMM,4),right(%YYYYMM,2)),-24,1),5),2)

Best Regards,

Jaymerry

Gysbert_Wassenaar

Read this document: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand