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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
cristianml
Post Prodigy
Post Prodigy

Format number color with dax

Hi,

 

I want to format number and color with dax. It works with "0,,M" but also I want to change the color.  Could you help me to fix the following ?

 

VAR VAR1 = "Revenue Actual:" & FORMAT([Actual Revenue], "0,,M" & "#00d600")

 

cristianml_0-1648841456957.png

 

Thanks

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @cristianml 

 

Formatting numbers and setting colors need to be separated into two Dax. I briefly simulated some data hoping it would fit your situation.

Measure1:

VAR VAR1 = "Revenue Actual:" & FORMAT([Actual Revenue], "0,,M")

Measure2:

Color = 
IF([VAR VAR1]="Revenue Actual:" & FORMAT([Actual Revenue], "0,,M"),"#00d600")

Then select the field to which you want to apply the color. Select the font color in conditional formatting.

vzhangti_0-1649146544290.pngvzhangti_1-1649146562331.pngvzhangti_2-1649146606319.png

The color needs to be set separately with Measure.

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @cristianml 

 

Formatting numbers and setting colors need to be separated into two Dax. I briefly simulated some data hoping it would fit your situation.

Measure1:

VAR VAR1 = "Revenue Actual:" & FORMAT([Actual Revenue], "0,,M")

Measure2:

Color = 
IF([VAR VAR1]="Revenue Actual:" & FORMAT([Actual Revenue], "0,,M"),"#00d600")

Then select the field to which you want to apply the color. Select the font color in conditional formatting.

vzhangti_0-1649146544290.pngvzhangti_1-1649146562331.pngvzhangti_2-1649146606319.png

The color needs to be set separately with Measure.

 

Best Regards,

Community Support Team _Charlotte

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

MattAllington
Community Champion
Community Champion

Read my article here https://exceleratorbi.com.au/conditional-formatting-with-a-text-field-in-power-bi/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.