sandy666
09-23-2020, 06:10 PM
SourceResult
FirstSecondThirdFourthFifthLabelFirstSecondThirdFo urthFifth
69
76
37
40
10Data
69
76
37
40
10
98
51
41
59
82Data
98
51
41
59
82
86
90
69
72
87Data
86
90
69
72
87
33
50
92
27
45Data
33
50
92
27
45
15
72
61
41
93Data
15
72
61
41
93
80
46
73
93
51Data
80
46
73
93
51
1
89
18
64
54Data
1
89
18
64
54
69
42
89
75
64Data
69
42
89
75
64
Total
451
516
480
471
486
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Label = Table.AddColumn(Source, "Label", each "Data"),
Move = Table.ReorderColumns(Label,{"Label", "First", "Second", "Third", "Fourth", "Fifth"}),
AddTotal = Table.AddColumn(Move, "Custom", each "Total"),
Group = Table.Group(AddTotal, {"Custom"}, {{"First", each List.Sum([First]), type number}, {"Second", each List.Sum([Second]), type number}, {"Third", each List.Sum([Third]), type number}, {"Fourth", each List.Sum([Fourth]), type number}, {"Fifth", each List.Sum([Fifth]), type number}}),
Ren = Table.RenameColumns(Group,{{"Custom", "Label"}}),
Append = Table.Combine({Move, Ren})
in
Append
FirstSecondThirdFourthFifthLabelFirstSecondThirdFo urthFifth
69
76
37
40
10Data
69
76
37
40
10
98
51
41
59
82Data
98
51
41
59
82
86
90
69
72
87Data
86
90
69
72
87
33
50
92
27
45Data
33
50
92
27
45
15
72
61
41
93Data
15
72
61
41
93
80
46
73
93
51Data
80
46
73
93
51
1
89
18
64
54Data
1
89
18
64
54
69
42
89
75
64Data
69
42
89
75
64
Total
451
516
480
471
486
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Label = Table.AddColumn(Source, "Label", each "Data"),
Move = Table.ReorderColumns(Label,{"Label", "First", "Second", "Third", "Fourth", "Fifth"}),
AddTotal = Table.AddColumn(Move, "Custom", each "Total"),
Group = Table.Group(AddTotal, {"Custom"}, {{"First", each List.Sum([First]), type number}, {"Second", each List.Sum([Second]), type number}, {"Third", each List.Sum([Third]), type number}, {"Fourth", each List.Sum([Fourth]), type number}, {"Fifth", each List.Sum([Fifth]), type number}}),
Ren = Table.RenameColumns(Group,{{"Custom", "Label"}}),
Append = Table.Combine({Move, Ren})
in
Append