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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors