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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
syasmin25
Helper V
Helper V

Count distinct ID if it is more than 6 periods

I am trying to counts students absent if they have skipped more than 8 bell periods on the same day. I was wondering if somebody could help me out here. I tried a distinct count with a counts of bell periods greater than 6 (that is the ballpark) but it is not working. I am providing a sample table below here.

Students IDBell PeriodDate
10116/1/2020
10126/1/2020
10136/1/2020
10146/1/2020
10156/1/2020
10166/1/2020
10176/1/2020
10186/1/2020
10196/1/2020
10316/1/2020
10326/1/2020
10336/1/2020
10346/1/2020
10356/1/2020
10326/2/2020

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You could try an expression like this:

 

More than 8 bells =
VAR summarytable =
ADDCOLUMNS (
SUMMARIZE ( Table, Table[Students], Table[PeriodDate] ),
"@BellsMissed", CALCULATE ( COUNTROWS ( Table ) )
)
RETURN
COUNTROWS ( FILTER ( summarytable, [@BellsMissed] > 8 ) )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

You could try an expression like this:

 

More than 8 bells =
VAR summarytable =
ADDCOLUMNS (
SUMMARIZE ( Table, Table[Students], Table[PeriodDate] ),
"@BellsMissed", CALCULATE ( COUNTROWS ( Table ) )
)
RETURN
COUNTROWS ( FILTER ( summarytable, [@BellsMissed] > 8 ) )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Greg_Deckler
Community Champion
Community Champion

@syasmin25 - So what are we looking at? Is that your source data and does it represent periods skipped or periods attended? What is the expected output from the sample data set?


Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

This is a sample that I created with periods that the students was marked absent.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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