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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Fali324
Helper II
Helper II

Colour using dax

Hi,

 

I have the following dax, I would like to colour the text green if it is above 0% and Red if it is a minus %

 

Var percentagedifferance =
    FORMAT(
        DIVIDE(contingencyremaining,contingencytotal),"Percent")
Can I do this in dax?
 
Thanks,
1 ACCEPTED SOLUTION
dharmendars007
Memorable Member
Memorable Member

Hello @Fali324 , 

 

Please copy the DAX formula below, because in your formula you are using Format which converts the Percent value to text, so remove the Format and apply divide and go to "FX" option where you want to apply condtional formatting like "Title" or "values" and from there select "Field Value" and select the below formula.

 

Var percentagedifferance =
    If(
        DIVIDE(contingencyremaining,contingencytotal)<0, "Red", "Green")
Return
percentagedifferance
 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

4 REPLIES 4
dharmendars007
Memorable Member
Memorable Member

Hello @Fali324 , 

 

Please copy the DAX formula below, because in your formula you are using Format which converts the Percent value to text, so remove the Format and apply divide and go to "FX" option where you want to apply condtional formatting like "Title" or "values" and from there select "Field Value" and select the below formula.

 

Var percentagedifferance =
    If(
        DIVIDE(contingencyremaining,contingencytotal)<0, "Red", "Green")
Return
percentagedifferance
 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

bhanu_gautam
Super User
Super User

@Fali324 ,DAX itself does not support conditional formatting directly within the formula. However, you can achieve this in Power BI by using the conditional formatting options available in the visualization pane

 

var percentagedifferance =
FORMAT(
DIVIDE(contingencyremaining, contingencytotal), "Percent")

 

Add this measure to a table or matrix visualization in your Power BI report.

 

Click on the table or matrix visualization to select it.
In the Visualizations pane, go to the "Values" section where your measure is listed.
Click on the drop-down arrow next to your measure and select "Conditional formatting" > "Font color".
In the conditional formatting window, choose "Rules".
Set up the rules to format the text color based on the value:
For values greater than 0, set the font color to green.
For values less than or equal to 0, set the font color to red.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you for your reply, I'm trying to use that measure as a title.

@Fali324 , Than you can use card with conditional formatting 

 

https://www.youtube.com/watch?v=zVJuDQdKXHY - check this




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.