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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aignn
Helper II
Helper II

How to anonymize names in table?

Hi!

 

I have table with names:

John Doe

Mary James

Johny Depp

Pater Griffin

John Doe

 

they can be repeated

 

I need anonymize names and bring them to this form:

John Doe > user-1

Mary James > user-2

Johny Depp > user-3

Pater Griffin > user-4

John Doe > user-1

 

This is possible?

Thank you advanced

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @aignn 

Sample PBIX file here.

Yes, Group By Name keeping all rows.  Then add an index column starting from 1 and add a Custom Column joining the real name and the index number.  Expand the rows again

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8srPyFNwyU9VitWJVvJNLKpU8ErMTS0Gc0FyeZUKLqkFBWB+QGpJapGCe1FmWlpmHlwFRHcsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Name"}, {{"Count", each _, type table [Name=nullable text]}}),
    #"Added Index" = Table.AddIndexColumn(#"Grouped Rows", "Index", 1, 1, Int64.Type),
    #"Added Custom1" = Table.AddColumn(#"Added Index", "Custom.1", each "user-" & Text.From([Index])),
    #"Expanded Count" = Table.ExpandTableColumn(#"Added Custom1", "Count", {"Name"}, {"Name.1"})
in
    #"Expanded Count"

 

anon-names.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@aignn , You can create a index column and add append that with user

 

index =https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

new column  = "User " & [index]

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
PhilipTreacy
Super User
Super User

Hi @aignn 

Sample PBIX file here.

Yes, Group By Name keeping all rows.  Then add an index column starting from 1 and add a Custom Column joining the real name and the index number.  Expand the rows again

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8srPyFNwyU9VitWJVvJNLKpU8ErMTS0Gc0FyeZUKLqkFBWB+QGpJapGCe1FmWlpmHlwFRHcsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Name"}, {{"Count", each _, type table [Name=nullable text]}}),
    #"Added Index" = Table.AddIndexColumn(#"Grouped Rows", "Index", 1, 1, Int64.Type),
    #"Added Custom1" = Table.AddColumn(#"Added Index", "Custom.1", each "user-" & Text.From([Index])),
    #"Expanded Count" = Table.ExpandTableColumn(#"Added Custom1", "Count", {"Name"}, {"Name.1"})
in
    #"Expanded Count"

 

anon-names.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors