|
本帖最后由 ThxAlot 于 2021-3-21 22:04 编辑
递归搞定,- let
- Recursion = (l as list, seed as text) =>
- List.Accumulate(
- l,
- seed,
- (s,c) =>
- let
- pos = List.PositionOf(Parent, c),
- res = if pos = -1 then c & ";" & s else @Recursion(Ar{pos}, s)
- in res
- ),
- Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XdHLEYAgDATQXjh7CPmgqcWx/zbEMGTMnuAtBMJw360TUTtioPYcM+grsG1GW7XAunBY0woe1Qr1ytWGDY4IOH2irfoidP8OvCzNYKleD/ast1Xvvs1gASvYwKN6Tv73OfTvDI79acYflRI8Lw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Row_idx = _t, Parent_idx = _t]),
- #"Grouped Rows" = Table.Group(Source, {"Parent_idx"}, {{"ar", each [Row_idx]}}),
- Parent = #"Grouped Rows"[Parent_idx],
- Ar = #"Grouped Rows"[ar],
- Invocation = Table.TransformColumns(#"Grouped Rows", {"ar", each Recursion(_, "")})
- in
- Invocation
复制代码
|
|