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
RyanHare92
Helper I
Helper I

DISTINCTCOUNT based on measure

I have the following dataset:

 

RyanHare92_7-1675775468140.png

 

and the following measures:

Count of Filters = if(ISFILTERED(Table1[Product]), COUNTROWS(FILTERS (Table1[Product])), 0)

Count = if(ISFILTERED(Table1[Product]), COUNT(Table1[Unique_ID]),0)

What I would like to to is, when I filter the table at Product, that a measure disctinct counts the unique_ID that have a count equivalent to the count of filters.

The following should be able to explain better:

When filtering to product 1, A list of all appear, because they all have product 1: 

 

RyanHare92_6-1675775456690.png

 

 

But when also selecting Product 2, A and B have a total count of 2 because they have entries for both product 1 and 2.

 

RyanHare92_5-1675775442514.png

 

 

Now, what I ultimately want, is a measure that can do a distinctcount on only the Unique_ID that have the Count equal the count of filters. In the above scenario, I would want the total to give me 2 (as only UNIQUE_ID A and B have both products 1 and 2).

I have put together the following:

Total = CALCULATE(DISTINCTCOUNT(Table1[Unique_ID]),FILTER(Table1, Table1[Count]=Table1[Count of Filters]))

but this doesn't seem to work. I understand why it's not working, but I can't seem to figure out how to put together a measure to calculate this for me.

Many thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@RyanHare92 , I think you need what I explained here

And for Selected Values, All selected values are present: https://youtu.be/X5T4rIZovHk

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@RyanHare92 , I think you need what I explained here

And for Selected Values, All selected values are present: https://youtu.be/X5T4rIZovHk

That was exactly what I needed. Worked like a charm! Thank you so much,  @amitchandak !

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.