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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
peps984
Frequent Visitor

Filter the count of distinct counts

Hi guys,

 

I have a table like this, imported from a CSV (I'm sorry I've not been able to render the table better than this):

 

itemyearcolumn3column4
alpha1980  
beta2000  
gamma2005  
alpha2000  
alpha2002  
gamma1999  
beta2000  
beta2000  
alpha1980  

 

Column3 and 4 contain other data not so relevant to the thread.

 

I need to calculate how many items have a distinct count for year > 1.

 

With this data, the result would be 2, because for item "alpha" the distinct count is 3, for "beta" it's 1 and for "gamma" it's 2.

 

I can easily calculate it with a table visual, but I need a card, just the number. I've tried to come up with a solution, but I can't figure out where to start

 

Could you please help me?

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@peps984 

you can try this

Measure = 
VAR _tbl=SUMMARIZE('Table','Table'[item],"count",DISTINCTCOUNT('Table'[year]))
return COUNTROWS(FILTER(_tbl,[count]>1))

1.PNG





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@peps984 

you can try this

Measure = 
VAR _tbl=SUMMARIZE('Table','Table'[item],"count",DISTINCTCOUNT('Table'[year]))
return COUNTROWS(FILTER(_tbl,[count]>1))

1.PNG





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

Proud to be a Super User!




yes!! 😀 this is what I was looking for.

Thanks for your help in finding the solution and the logic behind it 😊

you are welcome





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

Proud to be a Super User!




Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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