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.

Change colors based on values
Now we want to change the colors to display
- positive values in green
- negative values in red

Method to change colors according to values
Step 1: Call the 'conditional formatting' menu
- From the Format menu
- Select the Data Color option
- And you click on the fr icon

Step 2: Change the type of rule to apply
A new dialog box opens with the following predefined parameters

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.

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.

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

Step 6: Add a new rule

Step 7: Second rule for formatting
And for the second rule for positive values, we have the following parameters
- Over 0
- Less than 100

Chart with conditional formatting
The graph now shows negative values in red and positive values in green

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.
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