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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lpd82
Helper I
Helper I

Distinct Count Column

NameIdCount
John12
Bob12
John23
Frank23
Joe23

 

How can I add a column that count the numer of IDs.  I don't want to use measure or group by.  If I create a measure, the counts are wrong when I use the names in the report.

 

TIA

1 ACCEPTED SOLUTION

Can't seem to get it to work; I've found an alternative solution.  Thanks you.

View solution in original post

4 REPLIES 4
lpd82
Helper I
Helper I

Do I need to replace PriorStepName?  It said PriorStepName wasn't recognize.  I replaced it with an actual prior step name, also doesn't work.

It works on my side. 

Here is the query...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8srPyFPSUTJUitWJVnLKT4KzoRJGYI5bUWJeNpznlZ8KYccCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Id = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Count", each let x=[Id] in List.Count(List.Select(Source[Id], each _ = x ) ) )
in
    #"Added Custom"

 Result:

Jakinta_0-1633121359299.png

 

Can't seem to get it to work; I've found an alternative solution.  Thanks you.

Jakinta
Solution Sage
Solution Sage

You can add this step.

= Table.AddColumn(Source, "Count", each let x=[Id] in List.Count(List.Select( PriorStepName[Id], each _ = x ) ) )

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.