Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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,
Checking in to see if your issue has been resolved. let us know if you still need any assistance.
Thank you.
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!
Thanks for your answer.
My measure is something like that.
if you put hex code in measure it should work, select the colour from conditional format options visualization based on feild value
I already use hex code for color but still the same issues.
can you please try the measure using switch function, as suggested by @grazitti_sapna . it always works for me.
If you look at my measure and the bar chart. I added the color value as data label.
As you can see the measure returns the exact value that i need. But the bar chart color does not reflect the same color.
HI @3mmanuel_12,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.
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.
| User | Count |
|---|---|
| 50 | |
| 39 | |
| 29 | |
| 18 | |
| 17 |
| User | Count |
|---|---|
| 67 | |
| 58 | |
| 38 | |
| 21 | |
| 20 |