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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
M_SBS_6
Helper V
Helper V

Add unique ID column

Hi, 

I have a table with a text output and with my client I could have multiple rows. What I need to do is assign them a.  unique number from 1 onwards. Any idea if this can be done please?

     

Example 

Unique no.  Client 

    1                   FTY

    1                   FTY

  1                     FTY

  2                      Abat

  3                       Keys

   3                       Keys

   4                        Coast

5.                         Docks

2 ACCEPTED SOLUTIONS
serpiva64
Solution Sage
Solution Sage

Hi,

you can use remove duplicates on your column

serpiva64_0-1710495737755.png

and then add an index column (from 1 or from 0 as you prefer)

serpiva64_1-1710495808614.png

 

If this post isuseful to help you to solve your issue consider giving the post a thumbs up and accepting it as a solution !

View solution in original post

PijushRoy
Community Champion
Community Champion

Hi @M_SBS_6 

Please create a blank table in Power Query - Go to Advance Editor and paste the below code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcguJVIrVwaQdkxJLwAzv1MpiVIZzfmIxRM4lPzkbKBYLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Client = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Client", type text}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type"),
    #"Added Index" = Table.AddIndexColumn(#"Removed Duplicates", "Index", 1, 1, Int64.Type),
    #"Merged Queries" = Table.NestedJoin(#"Added Index", {"Client"}, #"Changed Type", {"Client"}, "Added Index", JoinKind.LeftOuter),
    #"Expanded Added Index" = Table.ExpandTableColumn(#"Merged Queries", "Added Index", {"Client"}, {"Client.1"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Added Index",{"Client"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Client.1", "Index"}),
    #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Client.1", "Client"}})
in
    #"Renamed Columns"

 

Source Data

PijushRoy_0-1710495841475.png

Result

PijushRoy_1-1710495854384.png

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

2 REPLIES 2
PijushRoy
Community Champion
Community Champion

Hi @M_SBS_6 

Please create a blank table in Power Query - Go to Advance Editor and paste the below code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcguJVIrVwaQdkxJLwAzv1MpiVIZzfmIxRM4lPzkbKBYLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Client = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Client", type text}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type"),
    #"Added Index" = Table.AddIndexColumn(#"Removed Duplicates", "Index", 1, 1, Int64.Type),
    #"Merged Queries" = Table.NestedJoin(#"Added Index", {"Client"}, #"Changed Type", {"Client"}, "Added Index", JoinKind.LeftOuter),
    #"Expanded Added Index" = Table.ExpandTableColumn(#"Merged Queries", "Added Index", {"Client"}, {"Client.1"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Added Index",{"Client"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Client.1", "Index"}),
    #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Client.1", "Client"}})
in
    #"Renamed Columns"

 

Source Data

PijushRoy_0-1710495841475.png

Result

PijushRoy_1-1710495854384.png

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





serpiva64
Solution Sage
Solution Sage

Hi,

you can use remove duplicates on your column

serpiva64_0-1710495737755.png

and then add an index column (from 1 or from 0 as you prefer)

serpiva64_1-1710495808614.png

 

If this post isuseful to help you to solve your issue consider giving the post a thumbs up and accepting it as a solution !

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.