Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
Solved! Go to Solution.
Hi @tuomaskb ,
You can select the visual and manually set the color or add conditional formatting in Color under the Format pane.
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:
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
Hi @tuomaskb ,
You can select the visual and manually set the color or add conditional formatting in Color under the Format pane.
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:
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.
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
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.
User | Count |
---|---|
106 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |