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
CarryASaw
Frequent Visitor

Creating a visual to have multiple condition to check if the criteria has been met.

Hi, I am trying to create a visual using if statements in DAX. I never get to understand and how to properly explain what Im after but, Ill try my best.

I want to create a visual table to check students exam results, and return a value to tell if that section passed or failed.

If Student 1 = Math, History, Science is passed, and Student 2 = Math, History, Science is passed. Then Section 1 passed.
Else if any of student failed one subject, then Section 1 has failed.

The table is this:

CarryASaw_0-1705881170819.png

By using the table above, Im trying to calculate if Section 1 passed or failed like this:

CarryASaw_1-1705881201888.png

 

Any help would be really great. I would love to know if this is possible.

 

Im having trouble because this is texts, and not numbers. Im unable to calculate the result.

Thank you so much everyone!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CarryASaw ,

Please follow these steps:

Since I wasn't very clear about the categorization of sections in your description, I created an extra column of sections as shown below:

vkaiyuemsft_0-1705916606731.png

1.Create the metric and write the following expression:

result =

VAR _count = COUNTX(FILTER(ALL('Table'),'Table'[Section] = MAX('Table'[Section])&&'Table'[Exam Result] = "Failed"),[Exam Result])

RETURN

IF(_count = BLANK(),"Passed","failed")

2.The result obtained is shown below:

vkaiyuemsft_1-1705916606732.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @CarryASaw ,

Please follow these steps:

Since I wasn't very clear about the categorization of sections in your description, I created an extra column of sections as shown below:

vkaiyuemsft_0-1705916606731.png

1.Create the metric and write the following expression:

result =

VAR _count = COUNTX(FILTER(ALL('Table'),'Table'[Section] = MAX('Table'[Section])&&'Table'[Exam Result] = "Failed"),[Exam Result])

RETURN

IF(_count = BLANK(),"Passed","failed")

2.The result obtained is shown below:

vkaiyuemsft_1-1705916606732.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Hi @Anonymous 
It worked.
Just a follow up question though, how do I add more filter?

I tried adding filter like this:

 

result =

VAR _count = COUNTX(FILTER(ALL('Table'),'Table'[Section] = MAX('Table'[Section])
&&
'Table'[Exam Result] = "Failed"),

'Table'[Exam Result] = "Not Yet Submitted")

,[Exam Result])

RETURN

IF(_count = BLANK(),"Passed","Failed")

 

I tried adding the "Not Yet Submitted" to be also considered as failed but no luck.

I tried to dabble with the code but DAX seems to find the results wrong even if I wrote it like this: 

 

ExamsResult = 

Var _count = COUNTX(FILTER(ALL('Sheet1'),

'Sheet1'[Subject] = MAX(Sheet1[Subject])
&&
Sheet1[Exam Result] = "Passed"),[Exam Result])

RETURN
IF(_count = BLANK(),"Failed","Passed")

 

I just tried to filter the passed instead, and reversed the return Failed if true, and Passed if false. 
It seems it doesnt work like I thought it would be.
It Resulted to this:

CarryASaw_0-1706052337406.png


To make it clear, I want to add another filter to make the result show it like this:

CarryASaw_0-1706053243177.png

by using this new table:

CarryASaw_2-1706052656545.png


Im sorry, I am new about this. I hope I explained my new problem properly. Thank you very much. 

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.