I have a sales data set and want to create a calculated column to be used as legend on graphs and also use as filter of dates but I'm struggling on with the part that identificate the previous 3 months before the last month.
My formula looks like this:
Period identification =
IF('Base'[Date]=CALCULATE(MAX('Base'[Date]);FILTER('Base';'Base'[FYTD]="FY1920"));"LM";
IF(
AND('Base'[Date]>=
DATEADD(CALCULATE(MAX('Base'[Date]);FILTER('Base';'Base'[FYTD]="FY1920"));-3;MONTH);
'Base'[Date]<CALCULATE(MAX('Base'[Date]);FILTER('Base';'Base'[FYTD]="FY1920")));"P3M";
IF('Base'[Date]=CALCULATE(MAX('Base'[Date]);FILTER('Base';'Base'[FYTD]="FY1819"));"LM YA";"OTHERS")))
The first IF() (Last Month - LM) and the last (Last Month Year Ago - LM YA) are working fine. I just can't find a way of PBI accept the kind of calculus I'm trying to do in the middle to identificate the previous 3 months before the last month.
*The [FYTD] is another calculated column that identificate the corresponding fiscal year of the [Date].[Month]
Thanks in advance