Get a list of expandable columns from a table input in Power Query
This example shows how to detect which columns in a Power Query table are expandable—meaning their values are records or lists—by returning a list of those column names. The code uses two custom functions in the M language: `expandableColumns` iterates over all column names and checks the type of the first row’s value in each column, while `columnHasConsistentType` verifies that a column’s type is uniform across all rows by comparing the record field structures of each value. The implementation relies on core M APIs like `Table.ColumnNames`, `Table.Column`, `Value.Type`, and `Record.Field`, and uses `List.Accumulate` for iteration and accumulation. This is a helper snippet intended for use inside Power Query, not a standalone visualization.
AI-generated description