Hello!
Is there any way to get de previous member -12?
I have the member 201810 , (otober 2018) , and the previousmember is 201809.
I need to get 201710 so i want to get previousmember -12.
Try lag(member,12)
You could also look at parallelPeriod. lag(member,N) will always go back N members, regardless of which level of the hierarchy you're looking at. parallelPeriod will always go back to the period you want, so let's say you are showing the hierarchy in a set, year, month, day. Using tuple(lag(currentMember(dateHier),12),measure) would show the value of the year 12 years back, the month 12 months back, and the day 12 days back. parallelPeriod ensures that it's always going back one year. tuple(parallelPeriod(yearLevel,1,currentMember(dateHier)),measure) will always go back a single year.
Hi ¡, I have similar problem, but in my case the current item is a "calculated item" as follow",
#'[BBDD_T].[TIEMPO MES DIA].[TIEMPO AÑO].[AÑO]->[all].['
+ (the snippet from before)
+']'#
How can I calculated the year -1?
In yours you are manually creating the member with a macro:
#'[BBDD_T].[TIEMPO MES DIA].[TIEMPO AÑO].[AÑO]->[all].['
+ timestampMask($current_timestamp,'yyyy')
+']'#
There are two ways you could go here. You could look for the prevMember from that:
prevMember(#'[BBDD_T].[TIEMPO MES DIA].[TIEMPO AÑO].[AÑO]->[all].['
+ timestampMask($current_timestamp,'yyyy')
+']'#)
Or you could calculate the previous year in the macro itself:
#'[BBDD_T].[TIEMPO MES DIA].[TIEMPO AÑO].[AÑO]->[all].['
+ timestampMask(_add_years($current_timestamp,-1),'yyyy')
+']'#
thx for the support, now is working!! ;)
You could also try something like this: https://stackoverflow.com/questions/38959458/subtract-month-from-yearmonth
Of course with the database syntax and functions available to you.