Forum Discussion
Dynamic Bar Chart Coloring: Adjusting Color Based on Slider
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
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.
- PijushRoy2 years agoCommunity Champion
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- Karie24132 years agoNew Member
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.