#powerquery #power_query
Step 1: Group by Column and select SUM
Step 2: Modify Formula with each _ & #table({},{{}})
Step 3: Expand Table and Remove Unneeded Column
Advanced Editor Code:
let
Source = null,
T1 = #table({"Col1", "Col2", "Col3", "Group"},{{"1", "2", "3", "1"}, {"11", "22", "33", "1"}, {"111", "222", "333", "2"}, {"A", "B", "C", "2"}, {"AA", "BB", "CC", "3"}, {"AAA", "BBB", "CCC", "3"}}),
#"Grouped Rows" = Table.Group(T1, {"Group"}, {{"Count", each _ & #table({},{{}})}}),
#"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Col1", "Col2", "Col3", "Group"}, {"Col1", "Col2", "Col3", "Group.1"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Count",{"Group"})
in
#"Removed Columns"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please checkout my book, Power Query M Language Basics Kindle Edition
https://www.amazon.com/dp/B0DM73H3RV
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~