Power BI Pie Chart Conditional Formatting

Do you want to apply conditional formatting to a Power BI Pie chart? In this Power BI tutorial, we will see how to apply conditional formatting to a Pie chart slicer and data value in Power BI.

Here, we will cover the topics below:

  • What is conditional formatting in Power BI?
  • Power BI Pie Chart Conditional Formatting
  • Power BI pie chart data value conditional formatting based on Color Scale.
  • Power BI pie chart data value conditional formatting based on Rules.

What is Condition formatting in Power BI?

Conditional formatting in Power BI is a feature that allows you to dynamically format visuals (such as tables, matrices, charts, and so on) based on conditions or rules. It allows you to visually highlight key data points, and trends in your reports, making it easier for users to find and analyze insights.

To apply conditional formatting, there are 3 ways:

  1. Rule: Rules allow you to define specific conditions for formatting individual data points within a visual
  2. Color scale/Gradient: Color scales in conditional formatting apply a gradient of colors to visual elements based on the relative values within a range.
  3. Field value: Field value formatting allows you to apply conditional formatting directly to the data values themselves within a visual.

Conditional Formatting Slices of a Power BI Pie Chart

Here, we will see how to format the slices of a Pie chart. Unfortunately, in Power BI, the Pie chart lacks a conditional formatting option to change slice colors based on conditions.

However, I’ll guide you on how to change the colors of Power BI pie chart slices.

For example, we will use the below Financial excel sheet to create a Pie chart.

Power BI pie chart conditional formattting

We will display the sales based on the segment in the Power BI Pie chart. As a pie chart, we cannot format the slices, so here we will convert the Pie chart to a bar chart, or you can directly create the bar chart. Then, we will apply the conditional formatting to it and convert it to a Pie chart.

Now, let’s see how we can apply the conditional formatting to slices of the Power BI Pie chart.

  • Open Power BI Desktop, and then click on Get data -> select Excel Workbook.
Power BI Pie chart Slices color based on value

Then select the Excel sheet from your local system; in the Navigator window, select the table and click on the Load button.

Power BI conditional formatting in Pie chart
Power BI Pie chart Slices conditional formatting
  • To show the sales based on segment, drag and drop the Sales and Segment columns to the X and Y axis, respectively.
Conditional formatting the Pie Visual
  • Next, click on the Format pane, then expand the Bar section.
  • Click on the fx in the color section.
Formatting the slices of a Pie Chart in Power BI
  • It will open the Conditional Formatting window. Here, select the Format style as a Gradient.
  • Select the Sales field in ‘What field should we base this on‘, select Sum as Summarization.
  • Next, ‘How should we format empty values‘ as ‘As zero‘.
  • Then, in Minimum value, select Custom from the dropdown and enter the value as 10,000,000. Select the color.
  • For the Maximum value select Custom from the dropdown and enter the value as 25,000,000
  • Also, you can enable the middle value by checking the box of Add a middle color. Then click on Ok
Conditional formatting the slices of a Pie Chart in Power BI

Now you can see the color formatting is applied to the bar chart in Power BI.

Conditional formatting the slices of a Power BI Pie Chart
  • To convert the bar chart to a pie chart, select the Pie chart from the visualization pane.
Conditional formatting the slices of Power BI Pie Chart

This is how to apply conditional formatting to the slices of a Pie Chart in Power BI.

Power BI pie chart conditional formatting based on gradient

Here, we will see how to apply conditional formatting on the Power BI Pie chart based on gradient.

For example, we will use the Financial Excel sheet data and will create a pie chart in Power BI Desktop, which shows information related to Sales based on Segment.

power bi pie chart color based on value

Based on the sales value, we will adjust the color gradient of the ‘Sum of Sales’ value or data label font color in the pie chart.

The gradient will be determined by three parameters: the lowest value, the middle value, and the highest value.

For example, suppose the minimum sales value is 10,000,000 and the maximum value is 25,000,000. In that case, the font color labels will transition from light yellow for lower sales to dark yellow for higher sales, with shades in between reflecting varying sales amounts.

To apply conditional formatting based on the Power BI pie chart gradient, follow the steps below.

  • In Power BI Desktop, select the Pie chart from the canvas.
  • Then click on the Format pane icon.
Microsoft power bi pie chart color based on value
  • Here expand the ‘Detail labels‘ section, expand the Values section.
power bi pie chart
  • Now, change the Display units to Thousands. If you want to increase the font size of the Data labels.
  • Then, in the Color section, click on the fx icon to apply conditional formatting.
  • Now, the Conditional formatting window will open.
power bi pie chart conditional formatting based on gradient
  • Here, select the Format style as a Gradient.
  • Select the Sales field in ‘What field should we base this on‘, select Sum as Summarization.
  • Next, ‘How should we format empty values‘ as ‘As zero‘.
  • Then, in Minimum value select Custom from the dropdown and enter the value as 10,000,000. And select the color.
  • For the Maximum value select Custom from the dropdown and enter the value as 25,000,000
  • Also, you can enable the middle value by checking the box of Add a middle color. Then click on Ok
Microsoft power bi pie chart conditional formatting based on gradient
  • Now you can see that the data label font color changes in the Power BI Pie chart.
Microsoft power bi pie chart conditional formatting based on color scale

Power BI pie chart data value conditional formatting based on Rules

Here, we will see how to apply conditional formatting based on rules in the Power BI Pie chart.

We’ll implement conditional formatting rules for the font color of data labels in the Power BI Pie chart, based on the Sum of sales segmented by category.

power bi pie chart color based on value

Here, we will apply the condition formatting rule to change the data label font color in the Power BI Pie chart. The rule is:

  • If the Total Sales amount is greater than 0 and less than 20000000, then the data label font color is light pink.
  • Else if the Total Sales amount is greater than 20000000 and less than 1000000000, then the data label font color is dark pink.

Now let’s see how we can apply the rule to the data label font color in Pie chart.

  • In Power BI Desktop, select the Pie chart from the canvas.
  • Then click on the Format pane icon.
Microsoft power bi pie chart conditional formatting based on rule
  • Here expand the ‘Detail labels‘ section, expand the Values section.
  • Then, click on the fx icon in the Color section to apply conditional formatting.
power bi pie chart conditional formatting based on rule
  • Now, the Conditional formatting window will open.
  • Here, select the Format style as a Rule.
  • Select the Sales field in ‘What field should we base this on‘, and select Sum as Summarization.
  • Next, If the value >0 [Number] and less than 20000000[Number], then the color is pink. Then click on the +New rule button.
  • If the value >20000000 [Number] and less than 1000000000, then the color is dark pink
  • Then click on Ok
pie chart conditional formatting based on rule

Now, you can see data label color changes based on the rule provided.

Power BI pie chart data value conditional formatting based on rule

Conclusion

In this Power BI tutorial, we saw what conditional formatting is. Also, we covered the topics below:

  • Format the slices of a Pie Chart in Power BI
  • Power BI pie chart data value conditional formatting based on Color Scale.
  • Power BI pie chart data value conditional formatting based on Rules.

You may also like:

>