提供一个思路,看能不能改成用递归实现:
- let
- 源 = Table.AddIndexColumn(Excel.CurrentWorkbook(){[Name="倍率"]}[Content],"id",1,1),
- 添加x = Table.AddColumn(源, "x", each 源),
- 展开x = Table.ExpandTableColumn(添加x, "x", {"成员", "倍率", "id"}, {"x.成员", "x.倍率", "x.id"}),
- 筛选x = Table.SelectRows(展开x, each [x.id]>[id]),
- 添加y = Table.AddColumn(筛选x, "y", each 源),
- 展开y = Table.ExpandTableColumn(添加y, "y", {"成员", "倍率", "id"}, {"y.成员", "y.倍率", "y.id"}),
- 筛选y = Table.SelectRows(展开y, each [y.id]>[x.id]),
- 添加z = Table.AddColumn(筛选y, "z", each 源),
- 展开z = Table.ExpandTableColumn(添加z, "z", {"成员", "倍率", "id"}, {"z.成员", "z.倍率", "z.id"}),
- 筛选z = Table.SelectRows(展开z, each [z.id]>[y.id]),
- 合并 = Table.Combine({筛选x,筛选y,筛选z}),
- 乘积 = Table.AddColumn(合并, "自定义", each List.Product({[倍率],[x.倍率],[y.倍率],[z.倍率]}))
- in
- 乘积
复制代码
|