Forum Discussion
Calculate a grade based on satisfaction (If-Statement | Switch-Statement ?) in DAX
Hello dear Power BI Community
I hope you're all doing well so far.
I have the following problem:
Based on the measured satisfaction i would like to give a grade (from E-A)
<20 = E | >= 20 - <50 = D | 50 = C | > 50 - <= 70 = B | >70 = A
How can I calculate my plan for a column in DAX?
| satisfaction | grade |
| 15.50 | E |
| 20.00 | D |
| 33.60 | D |
| 50.00 | C |
| 64.90 | B |
| 70.00 | B |
| 80.50 | A |
Thank you very much for your contribution.
Have a nice day.
Cheers
qwertzuiop
qwertzuiop try following
Grade = SWITCH ( TRUE(), [Satisfcation] > 70, "A", [Satisfcation] > 50, "B", [Satisfcation] >= 20, "C", "E" )
4 Replies
- parry2k
Super User
qwertzuiop try following
Grade = SWITCH ( TRUE(), [Satisfcation] > 70, "A", [Satisfcation] > 50, "B", [Satisfcation] >= 20, "C", "E" )- qwertzuiop
Advocate III
Hello parry2k
Unfortunately your solution does not work for me.
At the moment I'm trying to configure your proposed solution, but at the moment I have no luck.... 😞
- parry2k
Super User
qwertzuiop ok you mentioned it is not working, but please explain what is not working? I have no idea without you explain it. Share sample data, what calculation you added, and how you are visualizing it, and what it is not working?
More detail you provide, the quicker the solution will be.
Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490