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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
tuomaskb
New Member

Custom cell colors picked from table

It is possible to pick treemap cell colors from a table instead letting PowerBI randomly choose those?

 

My data is color usage, see picture, and it would make much more sense to the users to actually see the colors. I have is separate table colorcode linked to a color rgb values.

 

tuomaskb_0-1689683109898.png

 

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

Hi @tuomaskb ,

 

You can select the visual and manually set the color or add conditional formatting in Color under the Format pane.

vcgaomsft_0-1689829610613.png

For your scenario, you can create a new measure:

 

Measure = CALCULATE(MAX('ColourTable'[Colour]),'ColourTable'[Country]=MAX('Table'[Country]))

 

and use it for the conditional format:

vcgaomsft_1-1689830303209.png

please check the pbix file.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

5 REPLIES 5
v-cgao-msft
Community Support
Community Support

Hi @tuomaskb ,

 

You can select the visual and manually set the color or add conditional formatting in Color under the Format pane.

vcgaomsft_0-1689829610613.png

For your scenario, you can create a new measure:

 

Measure = CALCULATE(MAX('ColourTable'[Colour]),'ColourTable'[Country]=MAX('Table'[Country]))

 

and use it for the conditional format:

vcgaomsft_1-1689830303209.png

please check the pbix file.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

This is working, thank you!

 

Only problem was that I had 5000 colors in a table in rgb(int) format, had to make changes to the database to get rgb in hex format. Apparently DAX doesn't have needed functions to make conversion on PowerBi side.

miTutorials
Super User
Super User

You need to convert your RGB codes to HEX and then use the below measure.

 

 Color = MAX(Category[Hex Color Code])

 

Then Apply conditional formatting by  clicking on FX button under colors and choose Field Value as format style  and in the next section select the measure.

 

Regards

Ismail

www.youtube.com/MiTutorials

There are ~200 Power BI Tutorials on my channel, do check them out!

Thank you, but how do I calculate HEX using DAX?

You need to find the hex code for your RGB codes using some website and create a table.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.