Reputation: 1
How to change single column to multiple columns with values in power query editor?
Below is the input table in power query editor: enter image description here
Expected output: enter image description here
Tried using Pivot Columns and Transpose but error appearing and output not coming as expected.
Will be helpful if someone guide. Thanks!
Below is the input table in power query editor: enter image description here
Expected output: enter image description here
Tried using Pivot Columns and Transpose but error appearing and output not coming as expected.
Will be helpful if someone guide. Thanks!
Upvotes: 0
Views: 29
Reputation: 12111
Try the following:
Emp ID
and Name
.Emp ID
and retains Rows.Index
.let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Filled Down" = Table.FillDown(Source,{"Emp ID", "Name"}),
#"Grouped Rows" = Table.Group(#"Filled Down", {"Emp ID"}, {{"Rows", each _, type table [Emp ID=nullable number, Name=nullable text, Skills=nullable text]}}),
#"Added Index" = Table.TransformColumns(#"Grouped Rows", {"Rows", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}),
#"Added ColumnName" = Table.TransformColumns(#"Added Index", {"Rows", each Table.AddColumn(_, "ColumnName", each "Skill " & Number.ToText([Index]), type text)}),
#"Expanded Rows" = Table.ExpandTableColumn(#"Added ColumnName", "Rows", {"Name", "Skills", "ColumnName"}, {"Name", "Skills", "ColumnName"}),
#"Pivoted Column" = Table.Pivot(#"Expanded Rows", List.Distinct(#"Expanded Rows"[ColumnName]), "ColumnName", "Skills")
in
#"Pivoted Column"
Upvotes: 0