本帖最后由 onlylike 于 2023-7-24 16:19 编辑
let
源 = Excel.Workbook(File.Contents("C:\Users\Downloads\在query里算出累计值.xlsx"), null, true),
Sheet1_Sheet = 源{[Item="Sheet1",Kind="Sheet"]}[Data],
提升的标题 = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
分组 = Table.Group(提升的标题,"Part Number",{"累计值",each List.Sum([Sum])}),
合并 = Table.ExpandTableColumn(Table.NestedJoin(提升的标题, {"Part Number"}, 分组, {"Part Number"}, "分组", JoinKind.LeftOuter),"分组",{"累计值"}),
占比 = Table.TransformColumnTypes(Table.AddColumn(合并, "占比", each [Sum]/[累计值]),{{"占比", Percentage.Type}})
in
占比
|