Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Kedar_Pande
Super User
Super User

Dynamically Change Line Colors Based on a Threshold

I have a line chart showing "Sales Growth" over time, and I want to change the line color based on a threshold value (e.g., if growth is above 10%, the line should turn green; if below 10%, it should turn red).

Is there a way to apply this dynamic color change directly to the line chart in Power BI without splitting the data into multiple lines? What’s the best way to implement this?

 

Example Data:

Date Sales         Growth
Jan 2024               12%
Feb 2024                8%
Mar 2024              15%

2 ACCEPTED SOLUTIONS
BIswajit_Das
Super User
Super User
Arul
Super User
Super User

@Kedar_Pande ,

To achieve dynamically formatted color changes on a line chart (markers only) you can use conditional formatting on the markers. But, this requires initially creating a bar chart with conditional formatting and then changing it to a line chart. Or else you can try multiple measure approach.

Arul_0-1729516124753.pngArul_1-1729516143979.png


check this thread - https://community.fabric.microsoft.com/t5/Desktop/Line-Chart-Conditional-Formatting/m-p/375161





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @Kedar_Pande 

 

Currently Power BI's line charts do not support dynamic color changes based on thresholds on a single line.

As BIswajit_Das and Arul mentioned in their replies, it is currently possible to have a conditionally formatted bar chart and then change it to a line chart to achieve a similar effect.

 

If this alternative is helpful to you, please consider accepting their replies as a solution.
Or you can submit an idea at ideas.

 

Thank you for your understanding.

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I’ve already tried the bar chart workaround, but I need an exact solution to display the dynamic color changes based on thresholds on a single line.

anmolmalviya05
Super User
Super User

In Power BI, dynamic color changes based on a threshold for line charts are not directly supported in a single line chart visual. However, you can work around this limitation using the conditional formatting feature in combination with measures to achieve the desired effect. Here’s how you can implement it:

Step-by-Step Approach:

Create a Measure to Set Dynamic Color: You'll need to create a new measure to define the color logic based on your threshold (in this case, 10%).

Go to the Modeling tab and create a new measure with the following DAX formula:

LineColor = IF( SELECTEDVALUE('SalesData'[Growth]) >= 10%, "#00FF00", // Green if above or equal to 10% "#FF0000" // Red if below 10% )

Add a New Line Chart: Add your existing line chart using Date for the axis and Growth for the values.

  1. Conditional Formatting on the Line Chart: Unfortunately, Power BI does not yet support direct conditional formatting for line chart lines. So, the approach would be to split the data based on the threshold.
  2. You can use an approach like splitting your data into two measures for plotting two lines, one for growth above the threshold and one for below.
  3. Alternatively, if this approach doesn’t fit your needs, you can submit an idea for dynamic line chart formatting on the Power BI community page. The Power BI community is constantly improving based on user feedback.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

 

Let's Connect on LinkedIn: https://www.linkedin.com/in/anmol-malviya/?originalSubdomain=in

 

I need an exact solution to display the dynamic colour changes based on thresholds on a single line.

I will submit the idea.

Thanks

Arul
Super User
Super User

@Kedar_Pande ,

To achieve dynamically formatted color changes on a line chart (markers only) you can use conditional formatting on the markers. But, this requires initially creating a bar chart with conditional formatting and then changing it to a line chart. Or else you can try multiple measure approach.

Arul_0-1729516124753.pngArul_1-1729516143979.png


check this thread - https://community.fabric.microsoft.com/t5/Desktop/Line-Chart-Conditional-Formatting/m-p/375161





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Thanks for the reply @Arul .

This workaround can be used as changing colours on the line chart is not supported currently. 

BIswajit_Das
Super User
Super User

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.