Conditional formatting with Power BI

Last updated on 15/03/2025
Reading time : 3 minutes

How to apply conditional formatting on a Power BI chart? It's less simple than with Excel tools 🤔

Initial chart

In this example, we have the graphical result of our company's activity for each month.

When creating the chart, the formatting is standard. That is, we have a solid color for all values.

Initial graph presenting the difference between year N and N 1

Change colors based on values

Now we want to change the colors to display

  • positive values ​​in green
  • negative values ​​in red
Conditional formatting on Power BI charts

Method to change colors according to values

Step 1: Call the 'conditional formatting' menu

  1. From the Format menu
  2. Select the Data Color option
  3. And you click on the fr icon
Option to display conditional formatting of a chart

Step 2: Change the type of rule to apply

A new dialog box opens with the following predefined parameters

Basic conditional formatting offered for charts

However, the basic options proposed are not the best and we must rebuild the rule so that it applies to our data.

Step 3: Change the formatting option

In this dialog box, the option Color scale is the one selected by default. But in our case, it is not the one that suits us given the distribution of the data.

We do not want a color gradient between the highest or lowest value but clear colors. Everything positive in green, everything negative in red.

So to achieve this we will change the option Color scale by Rules.

Choice of rule type

Step 4: Choose the measurement to process

This step is the most important. Even if the measure is already present in the graph, it must be reselected in the list of fields.

Selecting the metric the conditional formatting rule is based on

Step 5: Define the first conditional formatting rule

We will start by managing negative values ​​to display in red. The parameter setting is as follows

  • Greater than -100
  • Less than 0
Power BI First conditional formatting rule

Step 6: Add a new rule

Add a new conditional formatting rule for Power BI

Step 7: Second rule for formatting

And for the second rule for positive values, we have the following parameters

  • Over 0
  • Less than 100
Power BI Second conditional formatting rule

Chart with conditional formatting

The graph now shows negative values ​​in red and positive values ​​in green

Conditional formatting on Power BI charts

Power BI training

Do you want to take Power BI training? I offer you training over 4 days (2 times 2 days) to be perfectly independent in the construction of modern dashboards.

You will find the training details on this page.

Comment

  1. GEOFFROY GIRODOLLE
    18/01/2022 @ 17:08 p.m.

    Hello,
    Can we sort the cells by color so as to have a color gradient:
    example:
    I have 447 colors from white to black through different gradients of yellow, blue, red, green, brown etc...
    sorting must group the whites, yellows, blues, reds, greens, browns etc. until black.
    the color cells are in DMC format, i.e. 447 colors.

    With the Excel sort by color function, this does not work.

    please

    Reply

Leave comments

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your feedback data is processed.

Microsoft MVP 2024

Newsletter

Once a month:
Tips and quizzes

    We won't spam you. You can unsubscribe at any time.

    Conditional formatting with Power BI

    Reading time: 3 minutes
    Last updated on 15/03/2025

    How to apply conditional formatting on a Power BI chart? It's less simple than with Excel tools 🤔

    Initial chart

    In this example, we have the graphical result of our company's activity for each month.

    When creating the chart, the formatting is standard. That is, we have a solid color for all values.

    Initial graph presenting the difference between year N and N 1

    Change colors based on values

    Now we want to change the colors to display

    • positive values ​​in green
    • negative values ​​in red
    Conditional formatting on Power BI charts

    Method to change colors according to values

    Step 1: Call the 'conditional formatting' menu

    1. From the Format menu
    2. Select the Data Color option
    3. And you click on the fr icon
    Option to display conditional formatting of a chart

    Step 2: Change the type of rule to apply

    A new dialog box opens with the following predefined parameters

    Basic conditional formatting offered for charts

    However, the basic options proposed are not the best and we must rebuild the rule so that it applies to our data.

    Step 3: Change the formatting option

    In this dialog box, the option Color scale is the one selected by default. But in our case, it is not the one that suits us given the distribution of the data.

    We do not want a color gradient between the highest or lowest value but clear colors. Everything positive in green, everything negative in red.

    So to achieve this we will change the option Color scale by Rules.

    Choice of rule type

    Step 4: Choose the measurement to process

    This step is the most important. Even if the measure is already present in the graph, it must be reselected in the list of fields.

    Selecting the metric the conditional formatting rule is based on

    Step 5: Define the first conditional formatting rule

    We will start by managing negative values ​​to display in red. The parameter setting is as follows

    • Greater than -100
    • Less than 0
    Power BI First conditional formatting rule

    Step 6: Add a new rule

    Add a new conditional formatting rule for Power BI

    Step 7: Second rule for formatting

    And for the second rule for positive values, we have the following parameters

    • Over 0
    • Less than 100
    Power BI Second conditional formatting rule

    Chart with conditional formatting

    The graph now shows negative values ​​in red and positive values ​​in green

    Conditional formatting on Power BI charts

    Power BI training

    Do you want to take Power BI training? I offer you training over 4 days (2 times 2 days) to be perfectly independent in the construction of modern dashboards.

    You will find the training details on this page.

    Newsletter

    Once a month:
    Tips and quizzes

      We won't spam you. You can unsubscribe at any time.

      Comment

      1. GEOFFROY GIRODOLLE
        18/01/2022 @ 17:08 p.m.

        Hello,
        Can we sort the cells by color so as to have a color gradient:
        example:
        I have 447 colors from white to black through different gradients of yellow, blue, red, green, brown etc...
        sorting must group the whites, yellows, blues, reds, greens, browns etc. until black.
        the color cells are in DMC format, i.e. 447 colors.

        With the Excel sort by color function, this does not work.

        please

        Reply

      Leave comments

      Your email address will not be published. Required fields are marked with *

      This site uses Akismet to reduce unwanted. Learn more about how your feedback data is processed.