Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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:

  1. 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.
  2. 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.
  3. 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 2
Anonymous
Not 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 He

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

MFelix
Super User
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.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.