Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
beatrizcorrea
New Member

DAX Conditional Formatting - Multiple Conditions traffic lights - PBI

I need to do conditional formatting where I will use semaphores. If the service level is greater than the target value, the traffic light will turn green, If the service level is less than the target value and greater than 50%, the traffic light will turn yellow, and if the service level is less than 50%, the traffic light will turn red. Bu I can't make it work with these conditions:

FarolKPI =
var cor = IF({_FactService_Measures[ServiceLevel]} >= SELECTEDVALUE(DimService[Target]), "Green",
IF({_FactService_Measures[ServiceLevel]} < SELECTEDVALUE(DimService[Target]) && {_FactService_Measures[ServiceLevel]} <= 0.5, "Yellow", "Red"
))

var icone = "data&colon;image/svg+xml;utf8," &
"<svg
xmlns='http://www.w3.org/2000/svg' viewBox='0
0 130 130'>

<circle cx='60' cy='60' r='55'
fill='" & cor & "' />
</svg>"

RETURN icone


Can someone help me, please?
Thank you!



1 ACCEPTED SOLUTION
beatrizcorrea
New Member

I found the solution, it is:

FarolKPI =
VAR target = SELECTEDVALUE(DimService[Target])
VAR cor =
    IF({_FactService_Measures[ServiceLevel]} >= target, "Green",
        IF({_FactService_Measures[ServiceLevel]} < target && {_FactService_Measures[ServiceLevel]} <= 0.5, "Red", "Yellow"))
VAR icone = "data&colon;image/svg+xml;utf8," &
"<svg
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 130'>

<circle cx='60' cy='60' r='55'
fill='" & cor & "' />
</svg>"

RETURN icone

View solution in original post

2 REPLIES 2
beatrizcorrea
New Member

I found the solution, it is:

FarolKPI =
VAR target = SELECTEDVALUE(DimService[Target])
VAR cor =
    IF({_FactService_Measures[ServiceLevel]} >= target, "Green",
        IF({_FactService_Measures[ServiceLevel]} < target && {_FactService_Measures[ServiceLevel]} <= 0.5, "Red", "Yellow"))
VAR icone = "data&colon;image/svg+xml;utf8," &
"<svg
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 130'>

<circle cx='60' cy='60' r='55'
fill='" & cor & "' />
</svg>"

RETURN icone
Anonymous
Not applicable

Hi @beatrizcorrea ,

I am glad you have solved the problem, please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Wisdom Wu

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors