Conditional Formatting in Power BI Line Chart

In this Power BI tutorial, we will see how to apply conditional formatting in Power BI line chart.

I recently needed to change the line color while working with line charts in a Power BI report.

Unfortunately, this functionality is currently not available in the Power BI line chart. But it is possible to change the color of a line marker in the Power BI line chart

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

Conditional Formatting in Power BI Line Chart

Here, we will see how to apply conditional formatting in Power BI line chart markers.

For example, we will use the below sample Excel table to create a Line chart.

power bi conditional formatting line chart

We will display the Profit based on the date in the Power BI Line chart. As a Line chart, we cannot format the Lines, so here we will convert the Line chart to a Column chart, or you can directly create the Column chart. Then, we will apply the conditional formatting and convert it to a Line chart.

Now, let’s see how we can apply the conditional formatting to the Power BI Line chart markers.

Apply Conditional formatting to the Power BI Line chart marker [Using Gradient]

  • Open Power BI Desktop, and then click on Get data -> select Excel Workbook.
Microsoft power bi conditional formatting line chart
  • Then select the Excel sheet from your local system; in the Navigator window, select the table and click on the Load button.
Microsoft power bi conditional formatting line chart marker
  • Select the Stacked column chart from the visualization pane to create the Column chart.
  • To show the Profit based on Date, drag anp the Profit and date columns to the Y-axis and X-axis, respectively.
power bi conditional formatting line chart marker
  • Next, click on the Format pane, then expand the Column section.
  • Click on the fx in the color section.
conditional formatting line chart marker in power bi
  • It will open the Conditional Formatting window. Here, select the Format style as a Gradient.
  • Select the Profit field in ‘What field should we base this on‘, and 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 500. Select the color.
  • For the Maximum value select Custom from the dropdown and enter the value as 1500.
  • Also, you can enable the middle value by checking the box of Add a middle color. Then click on OK.
power bi line chart markers conditional formatting

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

Microsoft power bi line chart markers conditional formatting
  • To convert the column chart to a Line chart, select the Line chart from the visualization pane.
  • Now, the line chart marker is formatted based on the value.
Conditional format the Power BI line chart with a gradient

Apply Conditional formatting to the Power BI Line chart marker [Using Rules]

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

See also  How to convert word to pdf using Power Automate [without a premium connector]

We’ll implement conditional formatting rules to the marker in the Power BI Line chart, based on the Profit by date.

Here, we will apply the condition formatting rule to change the color in the Power BI Line chart marker. The rule is:

  • If the Total Profit amount is greater than 0 and less than 1000, then the marker color is light pink.
  • Otherwise, if the Total Profit amount is greater than 1000 and less than 10000, then the marker color is dark pink.

Now, let’s see how we can apply the rule to the marker color in a Line chart.

  • In Power BI Desktop, select the Stacked column chart from the visualization pane to create the Column chart.
  • To show the Profit based on Date, drag and drop the Profit and date columns to the Y-axis and X-axis, respectively.
 power bi conditional formatting line chart marker
  • Next, click on the Format pane, then expand the Column section.
  • Click on the fx in the color section.
conditional formatting line chart marker in power bi
  • Now, the Conditional formatting window will open.
  • Here, select the Format style as a Rule.
  • Select the Profit field in ‘What field should we base this on‘, and select Sum as Summarization.
  • Next, If the value >0 [Number] and less than 1000[Number], then the color is pink. Then click on the +New rule button.
  • If the value >1000 [Number] and less than 100000, then the color is dark pink
  • Then click on Ok
Conditional format the Power BI line chart with a rule

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

Conditional format the Power BI line chart

To convert the column chart to a Line chart, select the Line chart from the visualization pane. You can see the line chart marker color changed based on color formatting.

Conditional format the Power BI line chart marker

This is how to apply conditional formatting to a Power BI line chart.

See also  How to do group by and calculate sum in Power Apps?

Conclusion

In this Power BI tutorial, we saw how to apply conditional formatting to Power BI line chart. We discussed two good examples, and I hope this will help you.

You may also like:

>