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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Karie2413
New Member

Dynamic Bar Chart Coloring: Adjusting Color Based on Slider

I want to dynamically change the color of individual bars on a bar chart based on the survey selected in a slider. However, I'm encountering difficulties as the data is organized in different columns of the table, leading to all bars changing colors instead of just the selected one.

My data structure is as follows:

Karie2413_0-1709134427059.pngKarie2413_1-1709134442857.pngKarie2413_2-1709134471485.pngKarie2413_3-1709134481059.png

The dashboard looks as follows

Karie2413_4-1709134491523.png

Any help or suggestions would be greatly appreciated. Thank you!

 

4 REPLIES 4
PijushRoy
Super User
Super User

Hi @Karie2413 

Please create a measure

 

Color = 
SWITCH(
TRUE(),
Selectedvalue(Table[Survey])="Survey 1","Green",
Selectedvalue(Table[Survey])="Survey 1","Yellow",
"Red")

 

 

In BAR color section, use Fx option and FieldValue from dropdown and use the Measure 
Example only

PijushRoy_0-1709134952528.png


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Thank you for responding so quickly. However, implementing your code results in all the bars changing colors, whereas my intention is to have only the selected bars change color. To clarify, when I select "Survey 1" on the slider, I expect only the bars corresponding to "good_price" and "good_quality" to change color, while the others remain unaffected.

Hi @Karie2413 

Please share complete requirement,
If Survey 1 what is the color for good_price and good_quality and rest of item
If Survey 2 what is the color for good_price and good_quality and rest of item




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





It dependend on the following table: 

Karie2413_0-1709136760380.png

Survey one has survey code 1, etc. So if you select survey 9, the only bar that changes color is the "good_quality" bar, and if you select survey 5, the only bar that doesn't change its color is the "Good_contact" bar. The color for the bars that correspond with the answers of the survey will become green, and the bars that are not selected are red.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors