Forum Discussion
spardadt
4 years agoFrequent 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.
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"
)
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/
2 Replies
- tackytechtomMost Valuable Professional
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/- spardadtFrequent Visitor
Holy crap I feel so dumb overlooking that and pulling my hair out for hours trying to figure it out. Thank you very much.