Forum Discussion

webportal's avatar
webportal
Impactful Individual
5 years ago
Solved

Conditional formatting of table rows

Ok, I promise I'll never understand conditional formatting in Power BI...

 

I want to format the rows of a table if column "Churn" is equal to "Label" like:

 

If it is: green

If it is not: red.

 

I tried all possible combinations with calculated measures, columns, etc, etc, etc, but nothing works.

 

Is it possible at all to do this?

 

Thank you!

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Try to do the following, create a measure

    "Color" = 

    VAR S_Value = SELECTEDVALUE(Table[Column])

    RETURN IF(S_Value = "Label", "#00FF00", "#FF0000")

     

    Then, select the column, go to Conditional Formatting > Background color > Field Value >Based on field: Select the measure "Color". That should do it.

    Note: #00FF00 is HEX code for green, #FF0000 for red. You can customize this by opening a color palette and retrieving the HEX code.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Try to do the following, create a measure

    "Color" = 

    VAR S_Value = SELECTEDVALUE(Table[Column])

    RETURN IF(S_Value = "Label", "#00FF00", "#FF0000")

     

    Then, select the column, go to Conditional Formatting > Background color > Field Value >Based on field: Select the measure "Color". That should do it.

    Note: #00FF00 is HEX code for green, #FF0000 for red. You can customize this by opening a color palette and retrieving the HEX code.

  • webportal's avatar
    webportal
    Impactful Individual

    Anonymous 

    Thanks for your help!