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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sparkplug93751
Helper II
Helper II

Count Values That Repeat in Column

Hello,

 

I have two column - name and employee

 

I need to count each time name appears more than 3 times ie they have >3 employees in a measure.


I have it down to a measure that counts rows then in the matrix it shows how many employees everyone has but I can't then count the number of names.

 

See attached data: https://tuprd-my.sharepoint.com/:x:/g/personal/tug67925_temple_edu/ET7ftu-eRp5MpxDnrwZAdg4BUI4LUppNd...

 

The measure should = 2 since Sam and Tim both have over 3 employees. I'm not looking for how many employees. Just the number of names with more than 3

1 ACCEPTED SOLUTION
nandukrishnavs
Community Champion
Community Champion

@sparkplug93751 

 

Try this

 

 

 

Measure = 
var _gp= SUMMARIZE('Table','Table'[Name],"_count",COUNT('Table'[Name]))
var result= COUNTROWS(FILTER(_gp,[_count]>3))
return result

 

 

 

Note: performance-wise this may not be a good solution. You can do the same thing in Query Editor.

 

Edit Query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCsnMVdJRMlSK1YGxjZDYxkhsEzDbJz89MQ/IM0XhmYF5wYkgdeZIbAsktiUS29AAmQO0PRYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, #"Employee #" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Employee #", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Count", each Table.RowCount(_), type number}}),
    #"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each [Count] > 3)
in
    #"Filtered Rows"

 

q.JPG

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

1 REPLY 1
nandukrishnavs
Community Champion
Community Champion

@sparkplug93751 

 

Try this

 

 

 

Measure = 
var _gp= SUMMARIZE('Table','Table'[Name],"_count",COUNT('Table'[Name]))
var result= COUNTROWS(FILTER(_gp,[_count]>3))
return result

 

 

 

Note: performance-wise this may not be a good solution. You can do the same thing in Query Editor.

 

Edit Query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCsnMVdJRMlSK1YGxjZDYxkhsEzDbJz89MQ/IM0XhmYF5wYkgdeZIbAsktiUS29AAmQO0PRYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, #"Employee #" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Employee #", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Count", each Table.RowCount(_), type number}}),
    #"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each [Count] > 3)
in
    #"Filtered Rows"

 

q.JPG

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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