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
shaggy101
New Member

Create new columns from unique IDs in one column

Hi there,

I'd like to go from this:

TeamRoleName
RedSupervisorJohn
RedManagerJerry
RedEmployeeJed

Orange

SupervisorBarry
OrangeManagerBill
OrangeEmployeeBob

To this:

TeamManagerSupervisorEmployee
RedJerryJohnJed
OrangeBillBarryBob

For a very large spreadsheet with many different unique "Roles"

Group By doesn't seem to be getting there.

Sorry for newbie question - deep searching of this forum didn't yield an answer but I'm probably searching poorly.

1 ACCEPTED SOLUTION
adudani
Super User
Super User

hi @shaggy101 ,

 

create a blank query, copy paste the below code into the advanced editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkpNUdJRCi4tSC0qyyzOLwJyvPIz8pRidWByvol5iempYInUoqJKJBnX3IKc/MrUVLBUCljCvygxLz0V3USnRJhGuDzCVKfMnBxUOSRznfKTlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Team = _t, Role = _t, Name = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Team", type text}, {"Role", type text}, {"Name", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Role]), "Role", "Name")
in
    #"Pivoted Column"

 

 

 output:

adudani_0-1722471671214.png

 

 

For reference:

 

Transpose, pivot or unpivot in Power Query? - YouTube 

 

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

View solution in original post

1 REPLY 1
adudani
Super User
Super User

hi @shaggy101 ,

 

create a blank query, copy paste the below code into the advanced editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkpNUdJRCi4tSC0qyyzOLwJyvPIz8pRidWByvol5iempYInUoqJKJBnX3IKc/MrUVLBUCljCvygxLz0V3USnRJhGuDzCVKfMnBxUOSRznfKTlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Team = _t, Role = _t, Name = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Team", type text}, {"Role", type text}, {"Name", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Role]), "Role", "Name")
in
    #"Pivoted Column"

 

 

 output:

adudani_0-1722471671214.png

 

 

For reference:

 

Transpose, pivot or unpivot in Power Query? - YouTube 

 

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

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.

Top Solution Authors