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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Need help in showing MoM variance

Hi, Actually I have a scenario where I need to show MoM variance% of the views of different reports. I have created two measures for that.

one for TotalViews

 

TotalViews = COUNTROWS(DISTINCT(consumer[session]))

 Second for variance

Variance% = DIVIDE( [TotalViews], CALCULATE( [TotalViews], DATEADD (DimDate[Date],-1,MONTH)), 0)-1

 when, I put these measures in a Matrix visual, the result is:

  Jan Feb Mar total 
Report NameViewsvar%Viewsvar%Viewsvar% Viewsvar%
ABC11-100.00%1536.3613-13.33%390.00%
DEF -100.00% -100.00%7-100.00%70.00%
GHI14-100.00%36157.14%6066.67%1100.00%
JKL10-100.00% -100.00%216-100.00%2260.00%
Total35-100.00%5145.71%296480.39%3820.00%

 

As you can see when I have no views/ blank values, the variance showing -100.00% -

  • How to get 0.00% in var% if i have to blank values.
  • Also the var% is showing incorrect percentage, 

 

Can someone please help me with this?

 

Thank you.

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

You can try to use the following measure formula if help:

Variance% =
VAR currDate =
    MAX ( DimDate[Date] )
VAR prevDate =
    DATE ( YEAR ( currDate ), MONTH ( currDate ) - 1, DAY ( currDate ) )
VAR currCount =
    COUNTROWS ( VALUES ( consumer[session] ) )
RETURN
    IF (
        currCount <> 0,
        DIVIDE (
            currCount,
            CALCULATE (
                COUNTROWS ( VALUES ( consumer[session] ) ),
                FILTER (
                    ALLSELECTED ( consumer ),
                    YEAR ( [Date] ) = YEAR ( prevDate )
                        && MONTH ( [Date] ) = MONTH ( prevDate )
                )
            )
        )
    )

If these also don't help, please share some dummy data with raw table structure to help us clarify your scenario and test to coding format.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous,

You can try to use the following measure formula if help:

Variance% =
VAR currDate =
    MAX ( DimDate[Date] )
VAR prevDate =
    DATE ( YEAR ( currDate ), MONTH ( currDate ) - 1, DAY ( currDate ) )
VAR currCount =
    COUNTROWS ( VALUES ( consumer[session] ) )
RETURN
    IF (
        currCount <> 0,
        DIVIDE (
            currCount,
            CALCULATE (
                COUNTROWS ( VALUES ( consumer[session] ) ),
                FILTER (
                    ALLSELECTED ( consumer ),
                    YEAR ( [Date] ) = YEAR ( prevDate )
                        && MONTH ( [Date] ) = MONTH ( prevDate )
                )
            )
        )
    )

If these also don't help, please share some dummy data with raw table structure to help us clarify your scenario and test to coding format.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (25)