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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
spardadt
Frequent Visitor

Switch Function not displaying correct result

Hello:
I've been trying to figure out what's wrong with my code for hours and cannot figure out. I'm trying to display a letter score based on the number score calculated from a measure. And for some reason, the corresponding letter to the score is wrong. It should be "D". It's a simple code but i really can't figure out what I'm doing wrong.
 
spardadt_3-1654805298332.png

 

OTD Score = Switch (
TRUE(),
SupplierPerformance[OTD %] >= 90, "A",
SupplierPerformance[OTD %] >= 80 && SupplierPerformance[OTD %] < 90, "B",
SupplierPerformance[OTD %] >= 70 && SupplierPerformance[OTD %] < 80, "C",
SupplierPerformance[OTD %] >= 60 && SupplierPerformance[OTD %] < 70, "D",
SupplierPerformance[OTD %] < 60, "F",
"N/A"
)

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @spardadt ,

 

First wild guess, could it be that your measure is displaying percentage, while your SWITCH checks on non percentage numbers? Maybe it works, if you write 0.9 instead of 90, 0.8 instead of 80 etc.

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @spardadt ,

 

First wild guess, could it be that your measure is displaying percentage, while your SWITCH checks on non percentage numbers? Maybe it works, if you write 0.9 instead of 90, 0.8 instead of 80 etc.

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Holy crap I feel so dumb overlooking that and pulling my hair out for hours trying to figure it out. Thank you very much.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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