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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Murf
Regular Visitor

Filter Data by number of instances

I have attendance data, where on any given day a number of students are marked, "Here", "Not Here", or "Excused." So the Data over a month, has multiple instances of the same student being marked marked, Here, Not Here, or Excused.  I need a way of generating a list of all the students who have 3 or more "Not Here"s in a given month.  This list will represent students who are no categorized as Ineligible.  

 

I was thinking I could Filter the table to show only those marked as Not Here within the month of October for example. But from there is where I get stuck.  Within that filtered table, how do I then check to see if a student has 3 or more instances? Then, once I do that, how do I generate a list of all those students with three or more? 

 

If it helps, I've attached a screenshot of what my attendance table looks like.  

 

Screenshot 2021-10-11 212746.png

Any advice would be super helpful!  Thanks so much

 

2 ACCEPTED SOLUTIONS
TheoC
Super User
Super User

Hi @Murf 

 

If you use a Matrix visual, you can set it up quite easily with your data as is:

TheoC_0-1634004118136.png

Just structure the Matrix table as per below:

 

TheoC_1-1634004141134.png

If you wanted to filter by Dates / Months, just use the Slicer visual and simply drag Date (Month) column into the slicer visual and you can slice and dice like that. 

 

If you wanted to have something such as "Accept" or "Flag" per student, you can use the following measure to produce the column "StudentsAbsent" on the right:

 

StudentsAbsent = 

VAR StudentsExcused = CALCULATE ( COUNTROWS ( 'Table' ) , FILTER ( 'Table' , 'Table'[Attendance] = "Excused" ) )

RETURN

SWITCH ( TRUE () , StudentsExcused >= 3, "Flag" , "Accept" )

TheoC_0-1634004718655.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

Hi @Murf, I am glad it is helpful! 

 

The "Count of Attendance" is simply the "Attendance" column being dragged into the visual and then using the little down arrow to select "Count". You can use that little arrow as a quick way of getting some simple outputs (i.e. Count, Distinct Count, Sum, etc., etc.) dependent upon the Data Type.

 

TheoC_0-1634011947042.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

5 REPLIES 5
TheoC
Super User
Super User

Hi @Murf 

 

If you use a Matrix visual, you can set it up quite easily with your data as is:

TheoC_0-1634004118136.png

Just structure the Matrix table as per below:

 

TheoC_1-1634004141134.png

If you wanted to filter by Dates / Months, just use the Slicer visual and simply drag Date (Month) column into the slicer visual and you can slice and dice like that. 

 

If you wanted to have something such as "Accept" or "Flag" per student, you can use the following measure to produce the column "StudentsAbsent" on the right:

 

StudentsAbsent = 

VAR StudentsExcused = CALCULATE ( COUNTROWS ( 'Table' ) , FILTER ( 'Table' , 'Table'[Attendance] = "Excused" ) )

RETURN

SWITCH ( TRUE () , StudentsExcused >= 3, "Flag" , "Accept" )

TheoC_0-1634004718655.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Murf
Regular Visitor

Oh this is super helpful and clever! Thanks so much!

 

One question though, what is Count of Attendance?

Hi @Murf, I am glad it is helpful! 

 

The "Count of Attendance" is simply the "Attendance" column being dragged into the visual and then using the little down arrow to select "Count". You can use that little arrow as a quick way of getting some simple outputs (i.e. Count, Distinct Count, Sum, etc., etc.) dependent upon the Data Type.

 

TheoC_0-1634011947042.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Murf
Regular Visitor

Oh wow, duh! Thank you!! You have just saved me a lot of time banging my head against the wall.  

@Murf hehe - trust me, we have all been there. That's how we all started this wonderful Power BI journey (anyone who says otherwise is full of rubbish lol).

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.