Creating "1st Month of the Year of the Previous Month" in a list
I have the following as a Range List which is the *First Month of Current Year* until previous month
I want to change the start of the list to be the first month of the previous year instead.
For example - when we get to Jan 2024, I want the list to be 202301-202312 - it is functional in its' current fomruntil Jan
{Range(StrToMember([Account Month].[Account Month],DateFormat(dateTime(), "YYYY")+"01"),lag(StrToMember([Account Month].[Account Month],DateFormat(dateTime(), "YYYYMM")),1))}
Is there a way to do this?
Thanks,
Satveer
4 replies
-
Hi ,
You could do something like this:
round(dateformat(datetime(),"YYYY")-1)+"01"
Similar to what you already have, just substracting 1 from the year and ensuring you don't have any ".0" generated in the automatic type casting (you can see we are jumping between text and number over and over again).
you could also use lag(12) to go 12 months backwards, assuming all the months exist in your data.