cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

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

Accepted Solutions
Highlighted
Super User VI
Super User VI

Re: Count distinct ID if it is more than 6 periods

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!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Highlighted
Super User IX
Super User IX

Re: Count distinct ID if it is more than 6 periods

@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.


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted
Helper IV
Helper IV

Re: Count distinct ID if it is more than 6 periods

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

Highlighted
Super User VI
Super User VI

Re: Count distinct ID if it is more than 6 periods

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!

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors