Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am currently using Power BI for educational statistics. Basically, I have a table of numeric scores (e.g. 30, 40.5, 60, 99.4 etc) and I wish to add a new column in the Query Editor to convert these numbers into letter grades with the following rules:
A: 70 to 100
B: 65 to 69
C: 60 to 64
😧 55 to 59
E: 50 to 54
F: 49 and below
Is there a efficient way to do this as I have multiple columns to convert? Thanks.
Solved! Go to Solution.
There is no SWITCH function in Power Query, so the easiest way to do this is create calculated column by using DAX.
Column =
var xx = Table1[Amout]
return SWITCH(TRUE(),xx>=70&&xx<=100,"A"
,xx>=65&&xx<=69,"B"
,xx>=60&&xx<=64,"C"
,xx>=55&&xx<=59,"D"
,xx>=50&&xx<=54,"E"
,xx<=49,"F")
Regards,
Charlie Liao
There is no SWITCH function in Power Query, so the easiest way to do this is create calculated column by using DAX.
Column =
var xx = Table1[Amout]
return SWITCH(TRUE(),xx>=70&&xx<=100,"A"
,xx>=65&&xx<=69,"B"
,xx>=60&&xx<=64,"C"
,xx>=55&&xx<=59,"D"
,xx>=50&&xx<=54,"E"
,xx<=49,"F")
Regards,
Charlie Liao
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.