This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
hi PBI, Can you help with coding a DAX with color code. Can I insert a color code into the DAX so it comes out in RED or Green visually
eg below
Change = if([Growth])>0,"Grow","Decline")
Growth | Change
0.12 | Grow <auttomatically green in color
-0.04 | Decline <automatically red in color
Solved! Go to Solution.
@Anonymous
Color coding in DAX is not possible, but as a workaround you can create two metrics:
metric1=if([Growth])>0,"Grow","")
metric1=if([Growth])<=0,"Decline","")
Add two card visuals to the report and pull metric1 into 1 card and metric2 into the other card. Now, change the font color for 1st card(where metric1 has been used) to green and 2nd card(where metric2 has been used) to red.
In this way, card 1 will show up only when [Growth])>0 and card 2 will show up only when [Growth])<=0
@Anonymous
Color coding in DAX is not possible, but as a workaround you can create two metrics:
metric1=if([Growth])>0,"Grow","")
metric1=if([Growth])<=0,"Decline","")
Add two card visuals to the report and pull metric1 into 1 card and metric2 into the other card. Now, change the font color for 1st card(where metric1 has been used) to green and 2nd card(where metric2 has been used) to red.
In this way, card 1 will show up only when [Growth])>0 and card 2 will show up only when [Growth])<=0
By creating "metric" do you mean adding new measure?
What do you mean by "pull metric1 into 1 card and metric2 into the other card"?
By creating "metric" do you mean adding new measure?
What do you mean by "pull metric1 into 1 card and metric2 into the other card"?
thanks.... although not ideal but works and i am using it now
Hi @Anonymous,
Current dax formula not support color code, I think you can post this requirement to ideas forum or use conditional formatting function to modify the display color.
Regards,
Xiaoxin Sheng
Conditional Formatting was just added to the visuals recently (June Power BI). It can't be used on the Text Entries but you could colour in the Growth column based on a range.
To do this, click on the Field in the Values area of your visualisations and select the down triangle to get the menu. The menu has conditional formatting and Color Scales.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 25 | |
| 23 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 50 | |
| 30 | |
| 23 | |
| 23 |