Forum Discussion
Conditional Formatting - Bar Chart from Field values
Hello All,
Can anyone help me.
I have a bar chart to show SLA category.
I need to implement a conditional formatting based on the SLA Policies. My issue is all measures work fine but the bar does not match with the appropriate color.
Note that the average time is in Hours
See image below.
Thanks for your support.
Hi 3mmanuel_12,
Thank you grazitti_sapna AnalyticPulse, for your insights,
I reproduced the scenario using sample data in Power BI Desktop and was able to observe the same behavior where the measure returns the correct Red/Green values, but the column chart color does not reflect the same result.
Thank you.
9 Replies
- grazitti_sapnaSuper User
Hi 3mmanuel_12 ,
Your measure should look like below(as you memtioned it's working fine)SLA Color =
VAR AvgHours = [Average Time Hours]
RETURN
SWITCH(
TRUE(),
AvgHours <= 24, "#28A745", -- Green
AvgHours <= 48, "#FFC107", -- Yellow
AvgHours > 48, "#DC3545", -- Red
"#808080" -- Default Grey
)Now follow the below steps:
In your Bar Chart:
-
Select the visual
-
Go to Format Pane
-
Expand Data Colors
-
Click fx
-
Choose: Format by β Field value
Based on field β SLA Color
This should fulfill your requirement
π I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
π‘ Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
π As a proud SuperUser and Microsoft Partner, weβre here to empower your data journey and the Power BI Community at large.
π Curious to explore more? [Discover here].
Letβs keep building smarter solutions together!
- 3mmanuel_12Regular Visitor
Thanks for your answer.
My measure is something like that.
CF Resolution Target =VAR _value=[Avg Resolution Time]- [Tickets Resolution Target]RETURNIF(_value>0,"Red", "Green")As you see in the image , in the table this measure returns the expected value Green or Red based on the condition.But it does not works in the bar chart.I used the same process as you mentioned above to apply color format- AnalyticPulseSolution Sage
if you put hex code in measure it should work, select the colour from conditional format options visualization based on feild value
-
- v-saisrao-msftCommunity Support
HI 3mmanuel_12,
Checking in to see if your issue has been resolved. let us know if you still need any assistance.
Thank you.