任意行列查询(Power Query)
问题:根据区块表和指标表,对源表进行筛选
let
源 = Excel.CurrentWorkbook(){[Name="源表"]}[Content],
匹配区块 = Table.NestedJoin(源, {"区块"}, 区块, {"区块"}, "匹配区块", JoinKind.RightOuter),
逆透视 = Table.UnpivotOtherColumns(匹配区块, {"区块"}, "属性", "值"),
匹配指标 = Table.NestedJoin(逆透视, {"属性"}, 指标, {"指标"}, "匹配指标", JoinKind.RightOuter),
删除的列 = Table.RemoveColumns(匹配指标,{"匹配指标"}),
已透视列 = Table.Pivot(删除的列, List.Distinct(删除的列[属性]), "属性", "值")
in
已透视列