Forum Discussion

p0nk's avatar
p0nk
Frequent Visitor
8 years ago
Solved

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. ...
  • MarcelBeug's avatar
    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