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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Cretemeausernam
Regular Visitor

define visual labels by table?

Hi,

 

I have a table of data sorted in this manner:

 

CategoryValue
A67
F76
A45
B30

 

I have a 2nd table with Category properties on it which includes hex colours

 

CategoryOriginColour

A

Europe118DFF
BAsiaAD5129
FUSAEC8FCA

 

 

What I'm trying to do is use the colour column in the category table to define the colour the category has in various visuals through reports (pie charts, stacked bar charts, line graphs)

 

This reason I don't want to do this manually is because the category table has 100s of rows.

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Cretemeausernam 

 

It is unsupported to format color for multiple visuals in Power BI Desktop currently. Visuals have different data points. You need to set a format for a specific visual. For tables and matrixs, you may use conditional formatting . For some other visuals, you need to define format for 'Data color'.

 

I created sample data to reproduce your scenario. You may try the following measure.

Measure = 
LOOKUPVALUE(Category[Colour],Category[Category],SELECTEDVALUE('Table'[Category]))

 

Conditional formatting for table visuals:

b1.png

 

Format for clustered column chart:

b2.png

 

Best Regards

Allan

 

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

 

 

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Cretemeausernam 

 

It is unsupported to format color for multiple visuals in Power BI Desktop currently. Visuals have different data points. You need to set a format for a specific visual. For tables and matrixs, you may use conditional formatting . For some other visuals, you need to define format for 'Data color'.

 

I created sample data to reproduce your scenario. You may try the following measure.

Measure = 
LOOKUPVALUE(Category[Colour],Category[Category],SELECTEDVALUE('Table'[Category]))

 

Conditional formatting for table visuals:

b1.png

 

Format for clustered column chart:

b2.png

 

Best Regards

Allan

 

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

 

 

mahoneypat
Employee
Employee

In query editor on transform tab, add # as a prefix to your colour column.  Then you can just use a measure like this to get your color code in a measure.  I named your example table Colors.  If you use Origin column in a visual, this will return you can use for the color (click on the fx button next to the color, choose Field Value and this new measure).

 

Origin Color = SELECTEDVALUE(Colors[Colour])
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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