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
AG_x11x
Frequent Visitor

specific variables assigned hex colour codes across any visualisation

Hi Friends

 

I was wondering if you have a good solution to setting certain data points/variables of a field in a table to be assigned a hex code so that when it is used in any visual that it is by default assigned this hex code? I know that we can pick / customise a hex code colour when it is in a visual however considering the volume of dashboards we need to create in a limited time this would be very time consuming. I know that we can create a default hex code per visual but I am after a solution where in any visual used this would be a default colour.

 

I used this solution but the limitation is that it doesn't work for line graphs:  https://www.youtube.com/watch?v=-FG0DSSAr60

Data:

E.g of specific variables assigned hex codes always

Class 1 = #FFFFFF

Class 2 = #FFA500

Class 3 = #FF0000

Class 4 = #00FF00

this is my code but it isn't translating into any of the line graph visuals... each value in a field here would be a name

colour hex #:
VAR selected value = SELECTEDVALUE(table[field]))
Return
SWITCH(selectedValue,
"A", "#FF0000"
"B", "#FFA500",
"#FFA500")

any suggestions on better process, script or perhaps SQL code is much appreciated

Many thanks in advance!

2 REPLIES 2
lbendlin
Super User
Super User

Thanks for your response 🙂 Essentially, using themes is too manual and slow because you would need to update each bar or line based on the data point. I was thinking about something faster like the script i provided above where certain data points in a field is hardcoded a hex code colour to speed up dashboard production. However, the caveat is that it doesn't populate for lines.

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.