Forum Discussion
Taffalaffa
2 years agoHelper I
Convert a list into columns in a table
Hi. I have the following table which is called activitycodeassignment. This is just a small filtered version for the purposes of my question. There is the a column that has the Code Category (ther...
- 2 years ago
Hi,
This code works
let Source = Excel.Workbook(File.Contents("C:\Users\mathu\Desktop\Try.xlsx"), null, true), #"Removed Other Columns" = Table.SelectColumns(Source,{"Data"}), #"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"Column1", "Column2", "Column3", "Column4", "Column5"}, {"Column1", "Column2", "Column3", "Column4", "Column5"}), #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]), #"Removed Columns" = Table.RemoveColumns(#"Promoted Headers",{"Code ID"}), #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[#"Code Category"]), "Code Category", "Code Value") in #"Pivoted Column"Hope this helps.
Ashish_Mathur
2 years agoSuper User
Hi,
This code works
let
Source = Excel.Workbook(File.Contents("C:\Users\mathu\Desktop\Try.xlsx"), null, true),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Data"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"Column1", "Column2", "Column3", "Column4", "Column5"}, {"Column1", "Column2", "Column3", "Column4", "Column5"}),
#"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]),
#"Removed Columns" = Table.RemoveColumns(#"Promoted Headers",{"Code ID"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[#"Code Category"]), "Code Category", "Code Value")
in
#"Pivoted Column"
Hope this helps.
Taffalaffa
2 years agoHelper I
Thank you so much Ashish! This is spectacular!
- Ashish_Mathur2 years agoSuper User
You are welcome.