Hi All,
I would require your guidance to understand a scenario. Basically i am calculating Previous Month values but it is giving me different results based on the context. So would require so help with respect to the same. Use case is as follows -
I have a fact table with Dates of start of the each month.The Previous month calculation used by me are as follows -
COUNT PM = CALCULATE(Measure);FILTER(all (Facttable);MONTH(Fact[PeriodDate]) = Month(Max(Fact[PeriodDate]))-1 && YEAR(Fact[PeriodDate] )= YEAR(MAX(Fact[PeriodDate]))))
The output of this measures gives me blank result of January every year. It would be great if someone can help put some light on the same.
When is use calculation as below the out put is correct.
Previous Month = CALCULATE(Measure);LASTDATE(DATEADD(Fact[PeriodDate];-1;MONTH)))
Please find attached the image_01 for the above two outputs
Now scenario 2 : -
When in my fact table i have dates of end of month i.e 30th or 31st of each month the calculation
Previous Month = CALCULATE(Measure);LASTDATE(DATEADD(Fact[PeriodDate];-1;MONTH)))
Gives me result only at the total level against the date context and not for all the dates. See the attachment image02.
Kindly request you to help me with the behavior of the dax in such scenario and provide me with the correct calculation for the same against the date context.