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
Donovin
New Member

Dax query working in power bi desktop but generates error in power bi portal

I am using the following DAX to calculate the month over month percentage differences for our costs. This DAX was working just fine until about last week. What I noticed is that in power bi desktop this works just fine but in Power bi portal it fails with the following error(see below)

What's even weirder is that this works for a smaller visual that only contains the difference in cost overall between this month and the previous month for all our azure subscriptions. But the second I change the matrix visual to include the azure subscription in the breakdown, it breaks the visualization with the following error.

Here showing the dax query working using a matrix visual(without adding the subscription name to the matrix). This works in both PBI desktop and portal

Donovin_0-1740415905491.png



Here is what it looks like in power bi desktop(working)

Donovin_1-1740415950585.png

 

Here is the error of the same visual in power bi portal

Donovin_2-1740415983741.png

 

I am not sure if this is related to the DAX code. I tried removing the format command after reading some other posts but this resulted in more issues.

DAX below

=======================

MOM % Difference =
VAR CurrentPeriod =
    FORMAT ( MAX ( 'CalendarAuto'[Date] ), "yyyymm" )
VAR PreviousPeriod =
    CALCULATE (
        FORMAT ( MAX ( 'CalendarAuto'[Date] ), "yyyymm" ),
        FILTER (
            ALL ( 'CalendarAuto' ),
            FORMAT ( 'CalendarAuto'[Date], "yyyymm" ) < CurrentPeriod
        )
    )
VAR CurrentCost =
    SUM ( Azure_Data_All[cost] )
VAR PreviousCost =
    CALCULATE (
        SUM ( Azure_Data_All[cost] ),
        FILTER (
            ALL ( 'CalendarAuto' ),
            FORMAT ( 'CalendarAuto'[Date], "yyyymm" ) = PreviousPeriod
        )
    )
RETURN
    IF (
        AND ( CurrentCost <> 0, PreviousCost <> 0 ),
        DIVIDE ( CurrentCost, PreviousCost, 0 ) - 1,
        BLANK ()
    )
1 REPLY 1
Anonymous
Not applicable

Hi, @Donovin 

 

Please refer to the following link and consider it related to the date table in your formula.

Solved: Measure works in Power BI Desktop but not after pu... - Microsoft Fabric Community

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.