Forum Discussion

lucie_rabochova's avatar
2 years ago
Solved

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 

  • talespin's avatar
    talespin
    2 years ago

    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.

10 Replies

  • 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

  • talespin's avatar
    talespin
    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

     

    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_rabochova's avatar
      lucie_rabochova
      Helper I

      Hi talespin,

      thank you for your answer.

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

       

      • talespin's avatar
        talespin
        Solution Sage

        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