Forum Discussion
Previous month % - error
Hello,
I'm trying to calculate previous month difference % in the attached dashboard. As you can see, the previous month function does not work properly at all and shows strange percentages. Sometimes % is missing etc.
Does anybody know what I'm doing wrong? Can somebody help please?
I'm attaching PowerBI Desktop file: https://drive.google.com/file/d/1MR9BP7BwVnnF_pH26VqLhHfNwVaTLTqF/view?usp=drive_link
Sorry I am not aware why this happens, even though there is nothing wrong with measure, I think I started seeing this issue with PowerBI Feb 24 release which I am currently using.
10 Replies
- Joe_BarrySolution Sage
Without seeing how your measures are written it is difficult, but the first thing I would do is put the Date in the Columns section of the visual
Share your measures if you need further assistence
Joe
If you found my answer helpful and it solved your issue, please accept as solution
- lucie_rabochovaHelper I
Hi Joe,
I have shared desctop file, its here https://drive.google.com/file/d/1MR9BP7BwVnnF_pH26VqLhHfNwVaTLTqF/view?usp=drive_link
- talespinSolution Sage
Your measure is comparing current month with previous month value and I checked at Date level and looks fine to me.
As for the Blank% there is no data for previous month. For ITA-City there is no data for 2023-02
I used below measure.
Views MoM% =VAR _SelectedYear = SELECTEDVALUE(DimDates[Year])VAR _SelectedMonth = SELECTEDVALUE(DimDates[Month])VAR _PrevYearMonth = EOMONTH(DATE(_SelectedYear, _SelectedMonth, 1), -1)VAR V = CALCULATE([Views], REMOVEFILTERS(DimDates), DimDates[Year] = YEAR(_PrevYearMonth) && DimDates[Month] = MONTH(_PrevYearMonth))RETURN DIVIDE([Views]-V, V)- lucie_rabochovaHelper I
Hi talespin,
thank you for your answer.
Can you please share the correct measure? Because I'm getting the below error, thanks
- talespinSolution Sage
Please use measure as it is, sorry I forgot to mention that you need to add Month column to your date table.
Please add this as calculated column to your Date table.
MONTH(DimDates[Date])Views MoM% =VAR _SelectedYear = SELECTEDVALUE(DimDates[Year])VAR _SelectedMonth = SELECTEDVALUE(DimDates[Month])VAR _PrevYearMonth = EOMONTH(DATE(_SelectedYear, _SelectedMonth, 1), -1)VAR V = CALCULATE([Views], REMOVEFILTERS(DimDates), DimDates[Year] = YEAR(_PrevYearMonth) && DimDates[Month] = MONTH(_PrevYearMonth))RETURN DIVIDE([Views]-V, V)pbix file