Forum Discussion

simple_test_1's avatar
simple_test_1
Microsoft Employee
5 years ago
Solved

Conditional Formatting on a per value basis in table

Is it possible to highlight cells in my table on conditions such as "if this number is greater than 0, highlight red, else don't highlight." When I try to do this, I only see conditional formatting b...
  • Anonymous's avatar
    Anonymous
    5 years ago

    You can achieve this by different simple options. 

    Option A: 

    Apply the conditional format by rules as you mention it. Since data will be on a table, aggreation won't matter because data will be at a row level thus you will have the cell value. That's the easiest one.

    Option B: 

    Go to Power Query and add a conditional column where" if column with x value is greather than 0 then:" you add the HEX code for red (#FF0000) else white (#FFFFFF). 

    Then, apply conditional format by field value and select the column with the HEX codes.

    Option C:

    Create a DAX measure with the following structure:

    MeasureForFormat =

    var cell_value = SELECTEDVALUE([ColumnWhereYourNumberIs])

    Return

    IF(cell_value > 0, "#FF0000", "#FFFFFF")

     

    Then, apply conditional formmating by field value and use this measure as field value. 

     

    I hope this helps 🙂