How To expand Dynamically, Column Headers When Using A Custom Function Dense Ranks of Groups in Powerquery

Viewed 47

I am stuck at expanding columns dynamically, following this trend i created here in this platform See :How To Effectively Dense Rank Groups in a Table Using Powerquery.

Now, intend to expand column dynamically, because, some of the dataset, in real life suituation, have huge numbers of columns, and manually entering the column names ,takes time and boring in order to take care of other column names. Secondly, if my dataset changes either by api,or by a change of column names, then , i run into error.how could i handle this challenge

Thank you.

1 Answers

If the column you want to expand is named custom and has a bunch of tables in it, you can use below to expand all the columns in that column

ColumnsToExpand = List.Distinct(List.Combine(List.Transform(Table.Column(#"PriorStepNameGoesHere", "Custom"), each if _ is table then Table.ColumnNames(_) else {}))),
#"ExpandedThem" = Table.ExpandTableColumn(#"PriorStepNameGoesHere", "Custom",ColumnsToExpand ,ColumnsToExpand )
Related