Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

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.

Percentage - WE.png
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 

1 ACCEPTED SOLUTION

hi @lucie_rabochova 

 

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.

View solution in original post

10 REPLIES 10
talespin
Solution Sage
Solution Sage

hi @lucie_rabochova 

 

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

talespin_0-1711267308442.png

 

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)

Hi talespin,

thank you for your answer.

Can you please share the correct measure? Because I'm getting the below error, thanks

lucie_rabochova_0-1711269055027.pnglucie_rabochova_1-1711269077695.png

 

hi @lucie_rabochova 

 

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_SelectedMonth1), -1)
VAR V = CALCULATE([Views]REMOVEFILTERS(DimDates), DimDates[Year] = YEAR(_PrevYearMonth) && DimDates[Month] = MONTH(_PrevYearMonth))
RETURN DIVIDE([Views]-VV)
 
pbix file

Thank you, it looks much better, one more thing, sometimes I can see strange total and subtotal % (see screenshot) I was trying to hide it (using special column) but it is still showing, is there any option to hide it? It is very confusing for our PowerBI users.

lucie_rabochova_0-1711296169983.png

 

I have found a solution for total nad subtotal % - I just hid it using white colour :-). I just wonder if it is possible to create a % only between the rows that are displayed? For example print screen showing 2024-01 and 2024-03, so the % should be difference between 01 and 03 and not 02 and 03, if you understand me.

lucie_rabochova_0-1711359732837.png

 

Thank you so much for your help!

 

hi @lucie_rabochova 

 

Please use this measure, it will hide % at BusinessUnit and Theme level.

It will compare months that are visible, depending on slicer selection.

 

Views MoM% =
VAR _SelectedYearMonth = SELECTEDVALUE(DimDates[YearMonthInt])
VAR _PreviousYearMonth = CALCULATE( MAX(FactChannel[Date]), ALLSELECTED(DimDates[YearMonth]), DimDates[YearMonthInt] < _SelectedYearMonth)
VAR V = CALCULATE([Views], REMOVEFILTERS(DimDates), DimDates[Year] = YEAR(_PreviousYearMonth) && DimDates[Month] = MONTH(_PreviousYearMonth))
RETURN IF( ISINSCOPE(DimDates[YearMonth]), DIVIDE([Views]-V, V), BLANK())

 

talespin_0-1711428149910.png

 

Added YearMonthInt and Month to date table.

DimDates =
VAR BaseCalendar =
        CALENDAR(DATE(2022,8,1), TODAY())
RETURN
    GENERATE(
        BaseCalendar,
        VAR BaseDate = [Date]
        VAR YearDate = YEAR(BaseDate)
        RETURN ROW (
            "Year",YearDate,
            "YearHalf",YEAR([Date])&" HY "&ROUNDUP(MONTH([Date])/6,0),
            "YearMonth",FORMAT(BaseDate,"yyyy-mm"),
            "YearQuarter", FORMAT(BaseDate,"yyyy") &"-"& FORMAT(BaseDate, "\Qq"),
            "YearMonthDate", FORMAT(BaseDate,"yyyy-mm-dd"),
            "YearMonthInt", INT(FORMAT(BaseDate,"yyyymm")),
            "Month", MONTH(BaseDate)
            ))

Thank you for the excelent solution, it works, I would accept this as solution, just quick question, if I put this measure to the original dashboard with original data, then VARs are underlined in red, but the formula works, any ideas why this is happening?

lucie_rabochova_0-1711461039175.png

 

hi @lucie_rabochova 

 

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.

Joe_Barry
Super User
Super User

Hi @lucie_rabochova 

 

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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.