Forum Discussion
p0nk
8 years agoFrequent Visitor
Combining multiple columns in a single table into one long column
Hello all, I may be missing something/not looking hard enough, but I cannot figure out a way to do this. I have 3 columns as shown in the image below that I want to combine into one long column. ...
- 8 years ago
If you don't need the null values, then you can unpivot all columns:
let Source = Input, #"Unpivoted Only Selected Columns" = Table.Unpivot(Source, {"Column1", "Column2", "Column3"}, "Attribute", "Conference Type"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Only Selected Columns",{"Attribute"}) in #"Removed Columns"If you want to keep the null values, then you can convert the table into columns (lists), combine these lists and convert the result back to a table:
let Source = Input, Result = Table.FromColumns({List.Combine(Table.ToColumns(Source))},type table[#"Conference Type" = text]) in Result
MarcelBeug
8 years agoCommunity Champion
If you don't need the null values, then you can unpivot all columns:
let
Source = Input,
#"Unpivoted Only Selected Columns" = Table.Unpivot(Source, {"Column1", "Column2", "Column3"}, "Attribute", "Conference Type"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Only Selected Columns",{"Attribute"})
in
#"Removed Columns"
If you want to keep the null values, then you can convert the table into columns (lists), combine these lists and convert the result back to a table:
let
Source = Input,
Result = Table.FromColumns({List.Combine(Table.ToColumns(Source))},type table[#"Conference Type" = text])
in
Result- p0nk8 years agoFrequent Visitor
Works perfectly, thanks!