Forum Discussion
Conditional formatting on bar chart for each bar? Is this possible?
Hi,
I am trying to create a type of bar chart, where each bar may be coloured depending on conditions and the measures I've created S1, S2, S3, S4.
Below is an example of the bar chart.
I would like to do this:
1. The bar "Below" will be red if S1 is a certain number
2. The bar "Marginal" will be yellow if S2 is a certain number
3. The bar "Meets" will be orange if S3 is a certain number
4. The bar "Exceeds" will be green if S4 is a certain number
Is there a way to do this in one graph? Through some research I've found I can do conditional formatting for all of the bars for the same measure, but not different measures...
I would appreciate any guidance on this.
Try this approach, Write a measure for conditional formatting with all your conditions and use it in fx.
2 Replies
- Arul
Super User
Try this approach, Write a measure for conditional formatting with all your conditions and use it in fx.
- AnonymousNot applicable
Hi, andrea100
Thanks for Arul's reply. You can refer to his method, or you can try the following measure.DAX:
Color = VAR _row = SELECTEDVALUE('Table'[Row]) VAR _re = SWITCH( TRUE(), [S1] = 1 && _row = "Below","Red", [S2] = 2 && _row = "Marginal","Yellow", [S3] = 3 && _row = "Meets","Orange", [S4] = 4 && _row = "Exceed","Green", "Blue" ) RETURN _reBest Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum