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

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.

Reply
casiopony
Regular Visitor

Filter student that failed an exam and never passed later

Hi, 

 

I am very new to Power BI

 

I have a table with exams results for students. Each student has a unique "ID number". Students who fail the exam can retake it as many times as they want.

 

I want to extract or filter the student number "ID number" of students who never passed the exam. 

 

Any idea?

 

Thank you

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @casiopony ,

Please add a new column with below dax formula:

never passed =
VAR cur_id = [id]
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[id] = cur_id )
VAR _str =
    CONCATENATEX ( tmp, [result], "," )
RETURN
    IF ( CONTAINSSTRING ( _str, "passed" ), BLANK (), "Yes" )

vbinbinyumsft_0-1669708140336.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

9 REPLIES 9
v-binbinyu-msft
Community Support
Community Support

Hi @casiopony ,

Please add a new column with below dax formula:

never passed =
VAR cur_id = [id]
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[id] = cur_id )
VAR _str =
    CONCATENATEX ( tmp, [result], "," )
RETURN
    IF ( CONTAINSSTRING ( _str, "passed" ), BLANK (), "Yes" )

vbinbinyumsft_0-1669708140336.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That is exactly what I was looking for. Thank you so much 🙏

sudhav
Helper V
Helper V

sudhav_0-1669299248480.png

This is your table, create 3 main measures 

1)

Totalstudents = DISTINCTCOUNT(StudentTable[id])
2)
passedstudents = CALCULATE(DISTINCTCOUNT(StudentTable[id]),FILTER(StudentTable,StudentTable[result]="passed"))
3)
Neverpassed = [Totalstudents]-[passedstudents]
 after that just take a table visual and take table visual like below and drag the columns like below
sudhav_1-1669299447026.png
Now just goto filter session and apply filters like below, then you will get required list of students who never passed
sudhav_2-1669299588340.png

I hope this is what tyou are searching for.... 

 

Let me know it is usefull or not....

 

casiopony
Regular Visitor

Thank you. 

 

Should I duplicate the table in POwer Query before doing this as I will still need access to the Passed information in other reports?

Yeah sounds good.

 

Feel free to mark as a solution if all okay 🙂

TotunG
Resolver I
Resolver I

What does the table look like? Even if you can use example data it would help. You basically need to filter by some other column that indicates whether a student has failed the exams/never passed. You could first implement this in Excel or the original table by doing something that tells you whether there has been any instances of a student passing. Like a COUNTIF or IF statement? 

Hi, thanks for the quick reply

 

the table looks like this (it has 220 000 row and growing)

 

idnameresult
456jackfailed
456jackfailed
456jackpassed
123johnfailed
123johnfailed
789michellefailed
789michellefailed
789michellefailed
789michellefailed
789michellefailed
741ahmedfailed
741ahmedpassed

 

I would like to be able to filter so it shows me that john and michelle never passed the exam. Maybe use a formula in a new column to tag those who never passed so it can then be filtered this way.

 

Okay, in Power Query/BI I would filter the Result column by 'Failed' then 'Remove Duplicates' on the ID column (just in case multiple people with same name). This should then give you all the names/IDs of students that have failed/never passed and will be updated live if you refresh it.

That doesn't work I am afraid. If I start by filter out by 'failed', my report will ignore whether a student id passed on another attempt.

 

I think i need to a formula that creates a 'never passed' column like this:

 

idnameresultnever passed
456jackfailed 
456jackfailed 
456jackpassed 
123johnfailedyes
123johnfailedyes
789michellefailedyes
789michellefailedyes
789michellefailedyes
789michellefailedyes
789michellefailedyes
741ahmedfailed 
741ahmedpassed 

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.