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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
Bron_Smith
Frequent Visitor

Dynamic line colours based on two slicers

I am using the latest version of Power BI (August 2025) and can't role back to previous versions - company policy

 

I have roughly 250 locations that I am displaying on a line chart (not all at the same time!). They are classed by region and area, and there are a maximum of 10 locations within an area, and up to 7 areas within a region. I am using slicers for the region and area to limit the number of locations displayed on the line chart.

 

When I use the Region and area slicers, I want to see the colours for the locations (labelled in a table 1-10 with the appropriate hex colour code) change the colours of the line on the graph to match the hex colour in the table I have created. I can't find any way to do this. I've tried using Switch and selected values, but this limits me and if more regions, areas or locations are created then I'll have to manually add that to the switch. I don't want more than 10 colours, so I've coded each location as 1-10 with 1 being "blue" and 2 being "green" etc...

 

Bars and Columns on the respective visuals are all very well, but I need this to be a line chart showing each of the locations in the appropriate colour, and trying to conditional format them doesn't work because I can't select the colour I have put into the table for this purpose. I have removed the legend, and this still doesn't do what I need it to do. 

 

Does anyone have any brilliant ideas that will make this work? 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Bron_Smith 

In Power BI, the only way to “lock” colors at the category level is through conditional formatting. Unfortunately, line charts do not support conditional line color formatting. There are multiple feature requests already open on this topic, and you can vote for them  (i voted)
https://community.fabric.microsoft.com/t5/Fabric-Ideas/Conditional-formatting-to-make-legend-and-lin...

 

https://community.fabric.microsoft.com/t5/Fabric-Ideas/Line-colour-in-line-chart-based-on-conditiona...

 

So at the moment, there is no way to lock colors in a line chart.
If your chart only shows a single line, this doesn’t really matter, and if it shows many lines, too many colors will create cognitive overload anyway. In that case, you might want to consider using small multiples, where each line is shown in its own panel without relying on color differentiation.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

2 REPLIES 2
Ritaf1983
Super User
Super User

Hi @Bron_Smith 

In Power BI, the only way to “lock” colors at the category level is through conditional formatting. Unfortunately, line charts do not support conditional line color formatting. There are multiple feature requests already open on this topic, and you can vote for them  (i voted)
https://community.fabric.microsoft.com/t5/Fabric-Ideas/Conditional-formatting-to-make-legend-and-lin...

 

https://community.fabric.microsoft.com/t5/Fabric-Ideas/Line-colour-in-line-chart-based-on-conditiona...

 

So at the moment, there is no way to lock colors in a line chart.
If your chart only shows a single line, this doesn’t really matter, and if it shows many lines, too many colors will create cognitive overload anyway. In that case, you might want to consider using small multiples, where each line is shown in its own panel without relying on color differentiation.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thanks for the reply. I ended up manually selecting a colour for each of the locations, by slicing them down first. Its not ideal, as any new locations will have to be added manually as well, but its sufficient for now. New locations are not added that often!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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