1
votes

I would like to expand all of the lists in this table at once without having to explicitly name (hard-code) each column. I do want to assume that all columns have a list in the row. I also want to be able to apply the solution to a table with less or more columns than are in the example. The table might decrease or increase its number of columns and the columns' names might change, which is why I don't want to use explicit column names.

I've found a few threads about expanding multiple lists at once, at various forum sites, but they all address more than just doing what I describe above and have all confused me to one degree or another as I've tried to fit them to my need.

@MarcelBeug provides a detailed solution at this site (as do other folks too). I'm using @MarcelBeug's function, and it works great; but I'd like to tailor it to just what I'm seeking, as mentioned above, and I'm having trouble doing that.

enter image description here

So how do I do this?

1

1 Answers

1
votes

You want to aggregate the Table.ExpandListColumn function across each column:

let
    Source = #table({"A", "B"}, {{ {1,2}, {3,4}} }),
    Expanded = List.Accumulate(
        Table.ColumnNames(Source), 
        Source, 
        (state, column) => Table.ExpandListColumn(state, column))
in
    Expanded