Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hoping this will be easy to answer.
I have a table which contains student results. Because of the different types of result that exist (9 to 1, and A to E), the data type has to be a string.
I have filtered my table to only show those grades that are 9 to 1, but as the data has to be live, I cannot change the column data type.
I need to create a measure that gets the sum of all of the grades for a given student, so need to convert the string values to integer values using DAX. Can this be done?
Solved! Go to Solution.
Can you try the following ? :
Total Grades =
SUMX(
FILTER(YourTableName, ISNUMBER(VALUE(YourGradeColumn))),
IF(
ISERROR(VALUE(YourGradeColumn)),
0,
VALUE(YourGradeColumn)
)
)
HI @Anonymous,
You can add a filter in your table to exclude the A to E text string, then you can use value function to convert these to numeric before aggregating these values.
formula =
SUMX (
ADDCOLUMNS (
FILTER (
ALLSELECTED ( Table1 ),
NOT ( [Results] IN { "A", "B", "C", "D", "E" } )
),
"Score", VALUE ( Table1[Results] )
),
[Score]
)
Regards,
Xiaoxin Sheng
Can you try the following ? :
Total Grades =
SUMX(
FILTER(YourTableName, ISNUMBER(VALUE(YourGradeColumn))),
IF(
ISERROR(VALUE(YourGradeColumn)),
0,
VALUE(YourGradeColumn)
)
)
Hello @Anonymous
Use FORMAT DAX function to change the datatype of that particular column in your calculations.
If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
74 | |
72 | |
39 | |
28 | |
27 |
User | Count |
---|---|
97 | |
97 | |
58 | |
45 | |
42 |