Forum Discussion

rshh's avatar
rshh
New Member
2 years ago
Solved

Combining header names and values for all rows into new column

Hi folks,   I am new in this community and I hope someone can help me with this slightly unusual problem. I did a lot of web research without success, but maybe I did not ask the right questions. ...
  • AlienSx's avatar
    2 years ago

    hello, rshh 

     

    let
        Source = your_table,
        cols = List.Buffer(Table.ColumnNames(Source)),
        p_info = Table.AddColumn(
            Source, "ProductInformation",
            (x) => 
                [a = List.Zip({cols, Record.FieldValues(x)}),
                b = List.Select(a, (w) => w{1} <> null),
                c = List.Transform(b, (w) => w{0} & ": " & Text.From(w{1})),
                d = Text.Combine(c, ", ")][d]
        )
    in
        p_info