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.
Hi,
I have a table of data sorted in this manner:
Category | Value |
A | 67 |
F | 76 |
A | 45 |
B | 30 |
I have a 2nd table with Category properties on it which includes hex colours
Category | Origin | Colour |
A | Europe | 118DFF |
B | Asia | AD5129 |
F | USA | EC8FCA |
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.
Solved! Go to Solution.
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:
Format for clustered column chart:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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:
Format for clustered column chart:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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).
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |