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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count Distinct IDs Based on two Filter Criteria

I have a table with IDs that I would like to create a measure to count the IDs  based on two criteria. 

 

I want to count those IDs when the two criteria match

 

Example

 

If Criteria 1 & 2 are the same, then count how many IDs that fall into that criteria.

 

ID                                        Criteria 1                                                      Criteria 2

1                                         USA                                                              12345678

2                                         USA                                                              12345678

3                                         USA                                                              12345678

 

 

Answer should be 3

 

Thanking you in advance

Joe

3 REPLIES 3
PattemManohar
Community Champion
Community Champion

@Anonymous Please try this, it will work for both as a "New Column" or "Measure"

 

CALCULATE(COUNTROWS(Test03Count),ALLEXCEPT(Test03Count,Test03Count[Criteria1],Test03Count[Criteria2]))

image.pngimage.png





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

Proud to be a PBI Community Champion




Gokul
Helper IV
Helper IV

Measure = CALCULATE( CALCULATE(COUNT(test[Column1] ),test[Column2]="usa"),test[Column3]="12345678")

Anonymous
Not applicable

Thank you @Gokul

 

There is multiple matching criteria in the table. Not Only USA or 12345678, there could be Canada and 23456789 or Mexico and 345678910

 

The idea would be to count ids that fall into those criterias.

 

Kind regards

Joe

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.