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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors