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
PaulPalkowski
Helper II
Helper II

Count rows from filtered measure

I have tried and tried to look for a solution, and didn't find anything that wasn't confusing. I must be over thinking this...

Here is my data, it's so very simple...only one column named Animal, with 16 rows. I am looking for a measure that returns the distinct count of animals that are on the list once, and a distinct count of animals that are on this list more than once. So in this instance, that are a total of  9 different animals, 3 animals are listed once and 6 are listed more than once. 

Animal
Lion
Lion
Bear
Dog
Cat
Bird
Bird
Deer
Monkey
Monkey
Cat
Bear
Beaver
Beaver
Beaver
Moose

I already have this

image.png

 

1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member

@PaulPalkowski 

 

Try this measures...

 

Single_Occurrence = 
VAR A = SUMMARIZE('Table (2)','Table (2)'[Animal],"Count1",COUNT('Table (2)'[Animal]))
RETURN CALCULATE(COUNT('Table (2)'[Animal]),FILTER(a,[Count1]=1))

 

 

Multiple_Occurrence = 
VAR A = SUMMARIZE('Table (2)','Table (2)'[Animal],"Count1",COUNT('Table (2)'[Animal]))
RETURN CALCULATE(COUNT('Table (2)'[Animal]),FILTER(a,[Count1]>1))

 

image.png

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

View solution in original post

9 REPLIES 9
VasTg
Memorable Member
Memorable Member

@PaulPalkowski 

 

Try this measures...

 

Single_Occurrence = 
VAR A = SUMMARIZE('Table (2)','Table (2)'[Animal],"Count1",COUNT('Table (2)'[Animal]))
RETURN CALCULATE(COUNT('Table (2)'[Animal]),FILTER(a,[Count1]=1))

 

 

Multiple_Occurrence = 
VAR A = SUMMARIZE('Table (2)','Table (2)'[Animal],"Count1",COUNT('Table (2)'[Animal]))
RETURN CALCULATE(COUNT('Table (2)'[Animal]),FILTER(a,[Count1]>1))

 

image.png

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

Thank you so very much, the first formula, works wonderful and returns 3 as expected, the second formula returns 13 and not 6. I am trying to get the count of the unique animals that are listed more than once. In this case, 6 is the count I am looking for.

image.png

 

@PPalkowski 

 

Replace the count with distinctcount in the return statement.

 

Multiple_Occurrence = 
VAR A = SUMMARIZE('Table (2)','Table (2)'[Animal],"Count1",COUNT('Table (2)'[Animal]))
RETURN CALCULATE(DISTINCTCOUNT('Table (2)'[Animal]),FILTER(a,[Count1]>1))

 

If it helps mark it as a solution

Kudos are nice too

Connect on LinkedIn

EXCELLENT!!!

Thank you so much..

hmmm, how to I mark this a 'the' solution...

😁

@PPalkowski 

 

I guess you should see accept a solution button in my response near reply...

Connect on LinkedIn

I don't see anything

image.png

 

I do not see ANY option to mark this as solved....

All I see is a thumb for Kudos , the number of kudos given and reply..

that's it

 

@PPalkowski 

 

Maybe the thread starter can do it.. @PaulPalkowski 

Connect on LinkedIn
VasTg
Memorable Member
Memorable Member

@PaulPalkowski @PPalkowski 

 

If I answered your question please mark it as a solution to close the topic.

Connect on LinkedIn

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.

Top Solution Authors