Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi all,
I'm currently doing a project and need some assistance. I'm still finding my way around DAX and I'm trying to get my MoM % change to turn red if the change is negative and green when it's positive. This is the DAX code, I've been using:
Please can someone assist me.
Thank you.
Solved! Go to Solution.
Hi @Anonymous00729,
This Approach should work with you give it a try :
Revenue MoM % with Arrow =
VAR upArrow = UNICHAR(9650) // ▲
VAR downArrow = UNICHAR(9660) // ▼
VAR change = [MoM % ▲]
VAR formattedText =
IF(
change > 0,
FORMAT(change, "0.00%") & " " & upArrow,
FORMAT(change, "0.00%") & " " & downArrow
)
RETURN
formattedTextTo apply conditional formatting in Power BI:
Go to Format → Data label → Conditional Formatting (fx)
Choose Field value → select your measure
Alternative DAX only approach (if you want everything in one measure):
Revenue MoM % with Arrow =
VAR upArrow = UNICHAR(9650)
VAR downArrow = UNICHAR(9660)
VAR change = [MoM % ▲]
VAR textColor =
IF(
change > 0,
"<span style='color:green'>",
"<span style='color:red'>"
)
VAR formattedText =
IF(
change > 0,
FORMAT(change, "0.00%") & " " & upArrow,
FORMAT(change, "0.00%") & " " & downArrow
)
RETURN
textColor & formattedText & "</span>"
The logic behind color formatting should be done with a measure based on a numerical value. Format() returns a text value.
My advice would be to seperate the calculation and the color designation.
I recreated your problem and with the following code you get your solution:
Revenue MoM % :=
VAR Curr = [Total Revenue] -- huidige maand
VAR Prev = [Previous Month Revenue] -- vorige maand
RETURN
DIVIDE( Curr - Prev, Prev )
Revenue MoM % with Arrow :=
VAR upArrow = UNICHAR(9650) -- ▲
VAR downArrow = UNICHAR(9660) -- ▼
VAR change = [Revenue MoM %]
RETURN
FORMAT( change, "0.00%" ) & " " &
IF( change > 0, upArrow, downArrow )
The above on is the value you use in the card visual
Measure for color formatting:
Revenue MoM Color :=
VAR change = [Revenue MoM %]
RETURN
SWITCH(
TRUE(),
ISBLANK(change), "#808080", -- gray when no value
change > 0, "#008000", -- green
change < 0, "#C00000", -- red
"#000000" -- black as fallback
)
And then you need to put the color measure in the formatting pane.
Format panel → Data label → Color → fx → Format by: Field value → Select Revenue MoM Color.
Hope this helps.
The logic behind color formatting should be done with a measure based on a numerical value. Format() returns a text value.
My advice would be to seperate the calculation and the color designation.
I recreated your problem and with the following code you get your solution:
Revenue MoM % :=
VAR Curr = [Total Revenue] -- huidige maand
VAR Prev = [Previous Month Revenue] -- vorige maand
RETURN
DIVIDE( Curr - Prev, Prev )
Revenue MoM % with Arrow :=
VAR upArrow = UNICHAR(9650) -- ▲
VAR downArrow = UNICHAR(9660) -- ▼
VAR change = [Revenue MoM %]
RETURN
FORMAT( change, "0.00%" ) & " " &
IF( change > 0, upArrow, downArrow )
The above on is the value you use in the card visual
Measure for color formatting:
Revenue MoM Color :=
VAR change = [Revenue MoM %]
RETURN
SWITCH(
TRUE(),
ISBLANK(change), "#808080", -- gray when no value
change > 0, "#008000", -- green
change < 0, "#C00000", -- red
"#000000" -- black as fallback
)
And then you need to put the color measure in the formatting pane.
Format panel → Data label → Color → fx → Format by: Field value → Select Revenue MoM Color.
Hope this helps.
Thank you so much for your help. This worked perfectly!
Hi @Anonymous00729,
This Approach should work with you give it a try :
Revenue MoM % with Arrow =
VAR upArrow = UNICHAR(9650) // ▲
VAR downArrow = UNICHAR(9660) // ▼
VAR change = [MoM % ▲]
VAR formattedText =
IF(
change > 0,
FORMAT(change, "0.00%") & " " & upArrow,
FORMAT(change, "0.00%") & " " & downArrow
)
RETURN
formattedTextTo apply conditional formatting in Power BI:
Go to Format → Data label → Conditional Formatting (fx)
Choose Field value → select your measure
Alternative DAX only approach (if you want everything in one measure):
Revenue MoM % with Arrow =
VAR upArrow = UNICHAR(9650)
VAR downArrow = UNICHAR(9660)
VAR change = [MoM % ▲]
VAR textColor =
IF(
change > 0,
"<span style='color:green'>",
"<span style='color:red'>"
)
VAR formattedText =
IF(
change > 0,
FORMAT(change, "0.00%") & " " & upArrow,
FORMAT(change, "0.00%") & " " & downArrow
)
RETURN
textColor & formattedText & "</span>"
Thank you so much for your help, this worked!
And thank you for the HTML bit as well, I will keep this for future reference.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |