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

Get number of records per group and filter

Hi,

I am looking for a fairly simple measure. I have a table where I have Trade_ID. For the same trade ID I might have different activities , for example:

 

Tradee_ID   Activity 

10009         New

10009         Modified

10009         Canceled

10098         Matched

10098         Validated

10989         New

10989         Matched

78909         New

 

 

What I want is the following: a measure that returns how many trade_id  for which the number of activities is > 1 

 

I should have 3 in my case ( I have 3 trade_id where they have more than 1 activity each)

 

How do I achieve this?

 

Many thanks

 

 

 

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

You could do this with a measure like the following that loops over all the distinct Tradee_ID values and checks if the count of Activity values is greater than 1

 

Measure = SUMX(DISTINCT('Table'[Tradee_ID]), IF(COUNTROWS(CALCULATETABLE(VALUES('Table'[Activity]))) > 1,1))

View solution in original post

2 REPLIES 2
d_gosbell
Super User
Super User

You could do this with a measure like the following that loops over all the distinct Tradee_ID values and checks if the count of Activity values is greater than 1

 

Measure = SUMX(DISTINCT('Table'[Tradee_ID]), IF(COUNTROWS(CALCULATETABLE(VALUES('Table'[Activity]))) > 1,1))

Thank you it worked. sorry for the late reply. I appreciate

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.