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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
benalfassy
Regular Visitor

Help with Filter + Distinct

Hi,

 

I have table with columns "status","ID"

 

I need to count the rows that have "Active" status but with distinct ID and then put it into a new measure.

 

How can i filter my table on "Active" status and then remove the non distinct rows + sum the result?

 

Thanks!

2 ACCEPTED SOLUTIONS

@benalfassy,

 

Please use the DAX below.

Measure 2 = CALCULATE(DISTINCTCOUNT(Table1[ID]),FILTER(Table1,Table1[Status]="Active"))

Capture.PNG

 

Regards,

Charlie Liao

View solution in original post

Hi,

 

Try this

 

=CALCULATE(DISTINCTCOUNT(Data[ID]),Data[Status]="Active")

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Omega
Impactful Individual
Impactful Individual

Can you please attach the table that you are using as your dataset along with the expected results? 

ID Status  
 1 Active    
 1Active  
1Not Active    
2Active    
3Not Active    
2Active   

 

i want to add new measure with value that based on the table above will be 2, because after i filter the Active and remove distinct i will have only 2 rows.

Hi,

 

Try this

 

=CALCULATE(DISTINCTCOUNT(Data[ID]),Data[Status]="Active")

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Omega
Impactful Individual
Impactful Individual

Try: 

 

Measure = CALCULATE(COUNTROWS(DISTINCT(Table1[ID])),FILTER(Table1,Table1[Status]="Active"))

I cant DISTINCT first because i might left with ID that have "Not Active" status although there is ID with Active status

@benalfassy,

 

Please use the DAX below.

Measure 2 = CALCULATE(DISTINCTCOUNT(Table1[ID]),FILTER(Table1,Table1[Status]="Active"))

Capture.PNG

 

Regards,

Charlie Liao

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors