Forum Discussion
Conditional Formatting - Bar Chart from Field values
- 5 months ago
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.
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_125 months agoRegular 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- AnalyticPulse5 months agoSolution Sage
if you put hex code in measure it should work, select the colour from conditional format options visualization based on feild value
- 3mmanuel_125 months agoRegular Visitor
I already use hex code for color but still the same issues.