Conditional formattting based on a text field

Hi there

I am keen to know if there is a way to do conditional formatting based on a text field. For example:
SCORE COLOUR
Good = Green
Fair = Yellow
Poor = Red

Thank you

Steve

@Floyd

Welcome to the Forum!

Please check out this video by Sam

It is possible to use colour names in DAX for conditional formatting. You’ll have to create some logic using a SWITCH statement, like in this example.

Colour = 
SWITCH( TRUE(),
 TestValue = "Good", "Geen"
 TestValue = "Fair", "Yellow"
 TestValue = "Poor", "Red"
 ) 

And here’s an overview of colour names that are supported in Power BI:

2 Likes

To add to Melissa’s response. You can also add the Hex# instead of using the name of the color. Here is what her SWITCH statement would look like after you apply the Hex#:

Colour =
SWITCH (
    TRUE (),
    TestValue = "Good", "#228c22",
    TestValue = "Fair", "#ffff00",
    TestValue = "Poor", "#cc2222",
    BLANK ()
)

Then you can go into conditional formatting and format by “Field Value”.

Here is another post with a similar topic that may be of help as well:

Thanks
Enterprise%20DNA%20Expert%20-%20Small

1 Like

Thank you so much Melissa. Very impressed with how quickly my very first forum post was replied to :smile:

You’re welcome Floyd

And please don’t forget if your question has been answered within the forum it is important to mark your thread as ‘solved’.

Thanks!

@Floyd, Hi and welcome.

You can also use uni-code symbols direct in DAX too… ie. “:red_circle:” bad or “:large_blue_circle:” good.