cancel
Showing results for
Did you mean:
Highlighted
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 ID Bell Period Date 101 1 6/1/2020 101 2 6/1/2020 101 3 6/1/2020 101 4 6/1/2020 101 5 6/1/2020 101 6 6/1/2020 101 7 6/1/2020 101 8 6/1/2020 101 9 6/1/2020 103 1 6/1/2020 103 2 6/1/2020 103 3 6/1/2020 103 4 6/1/2020 103 5 6/1/2020 103 2 6/2/2020

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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 =
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!

3 REPLIES 3
Highlighted
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

## 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

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

You could try an expression like this:

More than 8 bells =
VAR summarytable =
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!

Announcements

#### 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?

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

#### July 2020 Community Highlights

Learn about the exciting things that happened in July.

#### 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

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

Top Solution Authors
Top Kudoed Authors