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

Transpose Multiple values column with unique valued column

Hello,

 

I have a list of users column with a list of assigned projects column as shown below:

JosephKim_0-1641848609786.png

How can I convert it to have a list of project and a list of assigned names as shown below:

JosephKim_1-1641848702379.png

I could split the project by "," delimiter, but I don't know how to pivot/ transpose the table to generate a unique project list and have the assigned names to each project..

 

Any guidance would be deeply appreciated. 

 

Thank you so much,

Joseph

 

 

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Here's one way to do it in the query editor.  To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below. Note that it may be better to leave the data split out into rows and generate your list of names in a measure with CONCATENATEX().

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8spPVdJRctRxUorVAfEy8oBcJx1nMNc3sagSyHXWcVGKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Project = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Project", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Project2", each Text.Split([Project], ",")),
    #"Expanded Project2" = Table.ExpandListColumn(#"Added Custom", "Project2"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Project2",{"Project"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Project2"}, {{"People", each Text.Combine([Name], ", "), type text}}),
    #"Renamed Columns" = Table.RenameColumns(#"Grouped Rows",{{"Project2", "Project"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Project", type text}})
in
    #"Changed Type1"

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Here's one way to do it in the query editor.  To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below. Note that it may be better to leave the data split out into rows and generate your list of names in a measure with CONCATENATEX().

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8spPVdJRctRxUorVAfEy8oBcJx1nMNc3sagSyHXWcVGKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Project = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Project", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Project2", each Text.Split([Project], ",")),
    #"Expanded Project2" = Table.ExpandListColumn(#"Added Custom", "Project2"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Project2",{"Project"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Project2"}, {{"People", each Text.Combine([Name], ", "), type text}}),
    #"Renamed Columns" = Table.RenameColumns(#"Grouped Rows",{{"Project2", "Project"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Project", type text}})
in
    #"Changed Type1"

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you so mucn, @mahoneypat At first, I troubled with applying the script, but eventually I was able to edit it to work it out as you have guided. One question would be how to transform to unique value column for the project list?  I really appreciate your help! 

JosephKim_0-1641926835434.pngJosephKim_1-1641926883592.png

 

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