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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ArchStanton
Impactful Individual
Impactful Individual

Month on Month appears in Year column

Hi,

Does anyone know how I can show the results of this measure just for Months and not the Year Total? I want the red BLANK so it only shows values for the months.

 

ArchStanton_0-1706024058485.png

My code is:

 

Cases MoM% = 
VAR ActiveCase = [YTD Active Cases]
VAR ActiveCasesPM = [Previous Mth]
VAR Result = 
IF(
    [YTD Active Cases] <> 0 && [YTD Active Cases PY] <> 0,
    DIVIDE(ActiveCase - ActiveCasesPM, ActiveCasesPM)
)
RETURN
Result

 

Any help would be much appreciated!

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

Cases MoM% = 
VAR ActiveCase = [YTD Active Cases]
VAR ActiveCasesPM = [Previous Mth]
VAR Result = 
IF(
    [YTD Active Cases] <> 0 && [YTD Active Cases PY] <> 0,
    DIVIDE(ActiveCase - ActiveCasesPM, ActiveCasesPM)
)
RETURN IF(HASONEVALUE('Date'[Month name]),Result)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ArchStanton ,

 

A common approach to this scenario is to use the IF+HASONEVALUE function.
Try to modify your dax code like below:

Cases MoM% = 
VAR ActiveCase = [YTD Active Cases]
VAR ActiveCasesPM = [Previous Mth]
VAR Result = 
IF(
    HASONEVALUE('Date'[Month]),  -- Check if the context is at the month level
    IF(
        [YTD Active Cases] <> 0 && [YTD Active Cases PY] <> 0,
        DIVIDE(ActiveCase - ActiveCasesPM, ActiveCasesPM)
    )
)
RETURN
Result

 

Also you can check the following example which will help you understand.

vkongfanfmsft_0-1706086106116.png

 

 

Best Regards,
Adamk Kong

 

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

Ahmedx
Super User
Super User

pls try this

Cases MoM% = 
VAR ActiveCase = [YTD Active Cases]
VAR ActiveCasesPM = [Previous Mth]
VAR Result = 
IF(
    [YTD Active Cases] <> 0 && [YTD Active Cases PY] <> 0,
    DIVIDE(ActiveCase - ActiveCasesPM, ActiveCasesPM)
)
RETURN IF(HASONEVALUE('Date'[Month name]),Result)
ArchStanton
Impactful Individual
Impactful Individual

This works perfectly - thank you so much!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.