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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to change chart's bar colors dynamically for all categories based on values when using legend

Is there a way to change bar colors based on values? Specifically trying to make the bar color green when a positive value, and red when negative value for all categories without manually choosing colors when legend is also provided. The only thing I found so far is the ability to change advanced detail label color but not anything else. Ideally, changing the color should support gradient colors. And the function button only becomes available when legend field is not filled in.

 

The perfect outcome here would be to have the bars be light green when value is lets say 10 and dark green when the value is 1000 and then light red when -10 and dark red when -1000. DOMO does this well in comparison.

 

One possible solution we could think of is the use of sub report where a chart will be in its own report with preset theme red/green. The only issue here slicing and dicing may not work as expected with other visuals. I also tried some other 3rd party visuals without any luck so far.

 

Link to test file: https://gitlab.com/idevaton/power-bi-dashboards/-/blob/main/Bar%20Colors%20Test/BarColors.pbix

 

Thank you

 

Screenshot 2024-05-28 160906.pngScreenshot 2024-05-28 161246.png

2 REPLIES 2
Anonymous
Not applicable

HI,@Anonymous 

Regarding the issue you raised, my solution is as follows:
1. First, you can create a calculation column that automatically divides the data into positive or negative numbers:

status = IF('Data'[Shares]>=0,"over","low")

2. Second, you can modify the visual object Settings as shown below:

vlinyulumsft_0-1717040635393.png

vlinyulumsft_1-1717040645798.png

vlinyulumsft_2-1717040663341.png

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_3-1717040695629.png

We have not yet found a way to implement the color gradient according to the value size, if you find other solutions welcome to share with us.


Please find the attached pbix relevant to the case.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi, this solution looks like manually setting a color for each series and this is what we need to avoid. It is okay when there are a couple of values but if the legend had 50+ this solution is not feasable.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors