本帖最后由 ThxAlot 于 2022-8-30 22:03 编辑
按照mod 10的余数分一下组就行
- let
- Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("PU9LFgAhCLqL6xZj9j1Lr/tfYwKzDY+AUNeS3CWJ6oHcDlSQBxNkIDBlpxOOmLp2XyToofUx2kPLcNXAPgAYdZQVr8UI6ApNy/s1YowblWn3zYULWe9ShhnafDN2c+d3o0WGZ/c4Rfb+AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t, Column8 = _t, Column9 = _t]),
- #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", Int64.Type}, {"Column3", Int64.Type}, {"Column4", Int64.Type}, {"Column5", Int64.Type}, {"Column6", Int64.Type}, {"Column7", Int64.Type}, {"Column8", Int64.Type}, {"Column9", Int64.Type}}),
- #"Grouped by Mod" = Table.AddColumn(#"Changed Type", "Grp",
- each let
- grp = List.Accumulate(Record.ToList(_), List.Repeat({{}},10), (s,c) => let n = Number.Mod(c, 10) in List.ReplaceRange(s, n, 1, {s{n}&{c}})),
- pairs = List.Select(grp, each List.Count(_)>=2)
- in Text.Combine(List.Transform(pairs, each "(" & Text.Combine(List.Transform(_, Text.From),",") & ")"), ",")
- )
- in
- #"Grouped by Mod"
复制代码
|