Forum Discussion
Measure for Matrix
Issue Summary:
I am experiencing an issue in Power BI related to the creation of a measure using DAX. The specific problem involves writing a DAX formula to return values based on multiple conditions, including numerical values, text, and blanks. Here are the details:
DAX Measure Error:
- I initially attempted to create a measure using the following DAX formula:
Measure = IF( ISNUMBER('_Class Enrollment'[Final Grade MBA]) || ISTEXT('_Class Enrollment'[Final Grade MBA]), '_Class Enrollment'[Final Grade MBA], BLANK() ) - This resulted in a syntax error, indicating that the syntax for '_Class Enrollment'[Final Grade MBA] was incorrect.
- I initially attempted to create a measure using the following DAX formula:
Complex Conditional Logic for Measure:
- I need to create a measure Final Grade MBA based on the following conditions:
- If Grade Input = "INC", then "Incomplete"
- If Component = "MOD", then "Module"
- If Grading Basis Enrollment = "EXS", then "Exempted SAIS*"
- If Grading Basis Enrollment = "PNS", then "Passed SAIS*"
- If Grade Input <> " " (non-blank)
- If Grading Basis Enrollment = "AUD", then "Auditor"
- If Grading Basis Enrollment = "EXA", then "Exempted/Audit"
- If Grading Basis Enrollment = "EXE", then "Exempted"
- If Grading Basis Enrollment = "PNP" and Grade Input = "FA", then "Failed"
- If Grading Basis Enrollment = "PNP", then "Passed"
- If Official Grade <= -0.5, then "Failed (Official Grade)"
- If none of the above conditions are met, then return the Official Grade.
- I need to create a measure Final Grade MBA based on the following conditions:
DAX Formula for Measure:
- I attempted the following DAX formula for the measure:
Final Grade MBA = IF ( [Grade Input] = "INC", "Incomplete", IF ( [Component] = "MOD", "Module", IF ( [Grading Basis Enrollment] = "EXS", "Exempted SAIS*", IF ( [Grading Basis Enrollment] = "PNS", "Passed SAIS*", IF ( [Grade Input] <> " ", IF ( [Grading Basis Enrollment] = "AUD", "Auditor", IF ( [Grading Basis Enrollment] = "EXA", "Exempted/Audit", IF ( [Grading Basis Enrollment] = "EXE", "Exempted", IF ( [Grading Basis Enrollment] = "PNP" && [Grade Input] = "FA", "Failed", IF ( [Grading Basis Enrollment] = "PNP", "Passed", IF ( [Official Grade] <= -0.5, "Failed (" & [Official Grade] & ")", [Official Grade] ) ) ) ) ) ) ) ) ) ) )Despite following the correct DAX syntax, I am still facing issues with the implementation. I need assistance in identifying and resolving the syntax error and ensuring the logic works as intended in a measure.
2 Replies
- MFelix
Super User
Hi Anonymous ,
Are the values Grade Input, Grading Basis Enrollment, Official Grade Measures on your model? Asking this because of the syntax you are using.
Another questions is this a measure to be returned for a only a specific context or you want the result to be generic without any specific context select?
Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message. - AnonymousNot applicable
Hi Anonymous ,
Whether the advice given by MFelix has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.Best regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly