Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
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!
Solved! Go to Solution.
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)
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.
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
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)
This works perfectly - thank you so much!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 38 | |
| 36 | |
| 29 | |
| 28 |
| User | Count |
|---|---|
| 127 | |
| 88 | |
| 78 | |
| 66 | |
| 65 |