Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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:
The dashboard looks as follows
Any help or suggestions would be greatly appreciated. Thank you!
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
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
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
Proud to be a Super User! | |
It dependend on the following table:
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.