let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Grouped = Table.Group(Source, {"Emp ID", "Month", "Week Nb"}, {{"A", each Table.InsertRows(_,Table.RowCount(_),
{[Emp ID=null,Month=null,Week Nb =Text.From(List.Average([Week Nb]))&" Average",Value=List.Average([Value])]})}}),
Combine = Table.Combine(Grouped[A]),
GTotal = Table.InsertRows(Combine,Table.RowCount(Combine),{[Emp ID=null,Month=null,Week Nb ="Grand Average",Value=List.Average(Source[Value])]})
in
GTotal
Grouped = Table.Group(Source, {"Emp ID", "Month", "Week Nb"}, {{"A", each Table.InsertRows(_,Table.RowCount(_),
{[Emp ID=null,Month=null,Week Nb =Text.From(List.Average([Week Nb]))&" Average",Value=List.Average([Value])]})}}),
Grouped = Table.Group(Source, {"Week Nb"}, {{"A", each Table.InsertRows(_,Table.RowCount(_),
{[Emp ID=null,Month=null,Week Nb =Text.From(List.Average([Week Nb]))&" Average",Value=List.Average([Value])]})}},GroupKind.Local),
Someone has the same interestI'd be curious to know a bit more about timings, could you attach the 36000 row data?
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
GroupedWeek = Table.Group(Source, {"Emp ID", "Month","Week Nb"}, {"Value", each List.Sum([Value])}),
GroupedMonth = Table.Group(GroupedWeek, {"Emp ID", "Month"}, {{"A", each Table.InsertRows(_,Table.RowCount(_),
{[Emp ID=[Emp ID]{0},Month=Text.From([Month]{0})&" Total",Week Nb =null,Value=List.Sum([Value])],
[Emp ID=[Emp ID]{0},Month=Text.From([Month]{0})&" Average",Week Nb =null,Value=List.Average([Value])]})}}),
Combine = Table.Combine(GroupedMonth[A])
in
Combine
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
GroupedWeek = Table.Group(Source, {"Emp ID", "Month","Week Nb"}, {"Value", each List.Sum([Value])}),
GroupedMonth = Table.Group(GroupedWeek, {"Emp ID", "Month"}, {{"A", each Table.InsertRows(Table.AddColumn(_,"Average",each null),Table.RowCount(_),
{[Emp ID=[Emp ID]{0},Month=Text.From([Month]{0})&" Total",Week Nb =null,Value=List.Sum([Value]),Average=List.Average([Value])]})}}),
Combine = Table.Combine(GroupedMonth[A]),
Renamed = Table.RenameColumns(Combine,{{"Value", "Sum"}})
in
Renamed
I didn't test with a timer, but I couldn't discern an update time difference between the solutions in msgs #2 & #4 when working on the larger data source - quite unexpected.I'd be curious to know a bit more about timings, could you attach the 36000 row data?