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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Distinct count based off two columns

Hello

I am trying to create a measure that will distinct count based on more than one column.   I want to count if 1). InProgram is = 1 AND 2) the program ID is distinct.  I have included and example below.

 

lmyers31_0-1666984862025.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello please try :

 

Count of students = CALCULATE(DISTINCTCOUNT(lmyers31[Student ID]),FILTER(lmyers31,lmyers31[InProgram] = 1))

 

 

Screenshot 2022-10-28 231437.png

 

And result:

Screenshot 2022-10-28 231431.png

 

if this helps, kindly accept as solution and a kudos is appreciated

  

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

This worked perfectly. Thank you so much!

tamerj1
Super User
Super User

Hi @Anonymous 

please try the following measure 

Active Students =
COUNTROWS (
    CALCULATETABLE ( VALUES ( 'Table'[Student ID] ), 'Table'[InProgram] = 1 )
)

 

Anonymous
Not applicable

Hello please try :

 

Count of students = CALCULATE(DISTINCTCOUNT(lmyers31[Student ID]),FILTER(lmyers31,lmyers31[InProgram] = 1))

 

 

Screenshot 2022-10-28 231437.png

 

And result:

Screenshot 2022-10-28 231431.png

 

if this helps, kindly accept as solution and a kudos is appreciated

  

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.