Forum Discussion
Berean_50
Helper I
4 years agoHow to group rows dynamically
Given the following input: the goal is to produce the following output where the table is grouped by the static columns Name and Period. The challenging aspect of this task is that Category A,...
- 4 years ago
How about this?
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], DynamicColumns = List.RemoveItems(Table.ColumnNames(Source), {"Name", "Period"}), #"Grouped Rows" = Table.Group(Source, {"Name", "Period"}, List.Transform(DynamicColumns, (col) => {col, each List.Max(Table.Column(_, col)), type text})) in #"Grouped Rows"This takes the column names other than "Name" and "Period" and maxes over them in a Group By step.
Thingsclump
Resolver V
4 years agoHi Berean_50
For challenging part, I would recommend to rename 3rd, 4th and 5th column in PQ initially by referring position. You can use "Table.RenameColumns" using position. This way all steps downstream are not impacted.
Thankyou
Thingsclump