sandy666
07-31-2023, 01:19 AM
SourceResult
ToGroupResultToGroupResult
A
20A
40
BB
C
15C
15
A
20
B
ToGroupResultToGroupResult
A
20A
40
B
100B
100
C
15C
15
A
20
B
ToGroupResultToGroupResult
A
20A
40
B
5B
15
C
15C
15
A
20
B
10
ToGroupResultToGroupResult
A
20A
40
BJohnBMixedDataType
C
15C
15
A
20
B
10
ToGroupResultToGroupResult
A
20A
40
BJohnBJohn, Mark
C
15C
15
A
20
BMark
// Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Group = Table.Group(Source, {"ToGroup"}, {{"Result", each try try List.Sum([Result]) otherwise Text.Combine(List.Distinct([Result]), ", ") otherwise "MixedDataType", type any}})
in
Group
ToGroupResultToGroupResult
A
20A
40
BB
C
15C
15
A
20
B
ToGroupResultToGroupResult
A
20A
40
B
100B
100
C
15C
15
A
20
B
ToGroupResultToGroupResult
A
20A
40
B
5B
15
C
15C
15
A
20
B
10
ToGroupResultToGroupResult
A
20A
40
BJohnBMixedDataType
C
15C
15
A
20
B
10
ToGroupResultToGroupResult
A
20A
40
BJohnBJohn, Mark
C
15C
15
A
20
BMark
// Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Group = Table.Group(Source, {"ToGroup"}, {{"Result", each try try List.Sum([Result]) otherwise Text.Combine(List.Distinct([Result]), ", ") otherwise "MixedDataType", type any}})
in
Group