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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Alex-PBIComm
Helper II
Helper II

Colors in bar charts with hierarchy

Good morning everyone,

I'm trying to assign automatically a color to each region (see below), without having to select it manually under the visual options.

AlexPBIComm_0-1656843305870.png

Also, in the bar chart there's a drill down to country level, and I'm wondering wether it could be possible to maintain the Region colors when I get to the country view:

AlexPBIComm_1-1656843461642.png


The process of assigning colors should be automatic since the number of Regions is not static, and each Region might be split into two in the future.

Thanks for your help.

 

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @Alex-PBIComm ,

 

this is not possible as Power BI does not support a dynamic assignment of colors to column values.

 

You can achieve something that comes close to this, if store the color you want to use for a region/country inside the table and use conditional formatting to apply the colors accordingly, but this can become tedious.

The solution works something like this:

  1. Create a measure that checks if region/country has a single value, if yes look for the color stored
  2. Use the measure to control the background color or a similar aesthetic property like line color inside the conditional formatting

 

Hopefully, this provides you with some ideas to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
grantsamborn
Solution Sage
Solution Sage
TomMartens
Super User
Super User

Hey @Alex-PBIComm ,

 

this is not possible as Power BI does not support a dynamic assignment of colors to column values.

 

You can achieve something that comes close to this, if store the color you want to use for a region/country inside the table and use conditional formatting to apply the colors accordingly, but this can become tedious.

The solution works something like this:

  1. Create a measure that checks if region/country has a single value, if yes look for the color stored
  2. Use the measure to control the background color or a similar aesthetic property like line color inside the conditional formatting

 

Hopefully, this provides you with some ideas to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.