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 August 31st. Request your voucher.

Reply
ZacWatkins
New Member

Count Distinct Rows where Distinct Rows have at least X occurences

Hello!

 

I have what is most likely a measure request for sorting some data out of my general tables and into a visualization.

 

Right now I have a table with Employees and SubmissionIDs, plus a bunch of other columns that don't matter right now. I need to create a distinct count of employees who have at least 3 submissions. Since filters will occassionally change what employees are available, and I'll need to use this count in a few other calculations, I believe it needs to be a measure.

 

So Data Structure effectively looks like:

 

Dan1536
Dan1231
Dan5541
Dan1233
Harold1239
Jen1238
Jen1237
Jen1236
Harold1288
Betty1773
Dan1654

 

The resulting measure would say '2' (Dan and Jen, the other users haven't had enough submissions). DISTINCTCOUNT gets me how many unique users there are, which is great, but what I essentially need is a condition or filter to remove users that haven't made enough submissions.

 

I'm still pretty new to using measures with powerBI, so any help would be most appreciated!

1 ACCEPTED SOLUTION
YukiK
Impactful Individual
Impactful Individual

This is one way to do this:

Distinct Cnt of Employees Where Submission gt 2 =
VAR __SubmissionsPerEmployee =
ADDCOLUMNS(
SUMMARIZE(
'Table',
'Table'[employeeName]
),
"@CntOfSubmissions", CALCULATE( COUNTROWS( 'Table' ) )
)

VAR __Result = CALCULATE( DISTINCTCOUNT( 'Table'[employeeName] ), FILTER( __SubmissionsPerEmployee, [@CntOfSubmissions] > 2 ) )
RETURN
__Result

 

YukiK_0-1639599696944.png

 

View solution in original post

5 REPLIES 5
YukiK
Impactful Individual
Impactful Individual

This is one way to do this:

Distinct Cnt of Employees Where Submission gt 2 =
VAR __SubmissionsPerEmployee =
ADDCOLUMNS(
SUMMARIZE(
'Table',
'Table'[employeeName]
),
"@CntOfSubmissions", CALCULATE( COUNTROWS( 'Table' ) )
)

VAR __Result = CALCULATE( DISTINCTCOUNT( 'Table'[employeeName] ), FILTER( __SubmissionsPerEmployee, [@CntOfSubmissions] > 2 ) )
RETURN
__Result

 

YukiK_0-1639599696944.png

 

This one worked a treat! Thank you so much!

YukiK
Impactful Individual
Impactful Individual

Glad to be some help! Please give it a thums up too!

smpa01
Super User
Super User

@ZacWatkins  you can use a measure like this

Measure =
CALCULATE (
    DISTINCTCOUNT ( tbl[Emloyee] ),
    CALCULATETABLE (
        tbl,
        FILTER (
            tbl,
            CALCULATE ( COUNT ( tbl[Submission] ), ALLEXCEPT ( tbl, tbl[Emloyee] ) ) >= 3
        )
    )
)

 

smpa01_0-1639599468525.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

This one worked with my little test data sheet, but when I took it to the actual table it returned some odd numbers, I'll keep poking around and reply here if I figure out what went wrong. Thank you for your response!

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.

Top Solution Authors