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
Kavya123
Helper III
Helper III

Change Colors in Bar Chart by selecting color button

Hi Everyone,

 

I have a requirenment to edit the colors in Bar Chart. In the below attached screenshot for example if we click on red color button then all the bar charts should display red color bars.  Similarly if we select green button then the bars should change to green color.

 

Thanks in advance.

 

colors.png

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

Not functionality that exists out of the box, but there are a couple of workarounds that might give you something similar

 

You could try bookmarks and buttons, in power bi desktop use ctrl-click to use buttons

Or you could use a dummy table to create a measure which control the colors of a chart

 

both methods are shown in this file:

example filbookmarks.PNGmeasure.PNG

View solution in original post

5 REPLIES 5
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

Not functionality that exists out of the box, but there are a couple of workarounds that might give you something similar

 

You could try bookmarks and buttons, in power bi desktop use ctrl-click to use buttons

Or you could use a dummy table to create a measure which control the colors of a chart

 

both methods are shown in this file:

example filbookmarks.PNGmeasure.PNG

Hi,

 

Thank you so much it worked...

@sturlaws

 

I am also interested in your solutions. However, I can't access to your file because I am in China. I know how to do that by using bookmarks.

 

Could you please share a little bit more info on useing dummy table? Are you using coding to choose color?

 

Thanks in advance





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu, off course,

 

First create a stand alone table, tableColor, with a column with the numbers 1 to 4.

On this column, create a measure like this: 

MeasureColor = if(HASONEVALUE(TableColor[Column1]);min(TableColor[Column1]);1)

Create a scatterplot, put column1 from Table on Details, Legend and y-axis.
 
Then create for example a bar chart on some other data in your model. In this chart, go to Formatting-> Data colors -> Advanced controls.  Change to Format by Rule, and based it on MeasureColor. rules.PNG 
The datacolor of the bar chart will now change according to the value of measureColor, which again will change value when TableColor is filtered. If TableColor is not filtered the default value of measureColor=1
 
Regards,
Sturla

@sturlaws

 

Thanks for the sharing. That's very interesting. I will try that.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.