|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- let
- pricelist = [a=Table.PromoteHeaders(Excel.Workbook(File.Contents("你的文件位置\补贴单价表.xlsx"), null, true)[Data]{0}),
- b=Table.Group(a,List.FirstN(Table.ColumnNames(a),3),{"n",each Table.FromColumns({List.Transform([单次运输吨位区间],each Number.From(Text.Split(Text.Remove(_,"吨"),"-"){0})),[#"补贴单价(元/吨)"]})})
- ][b],
- Source = Table.PromoteHeaders(Excel.Workbook(File.Contents("你的文件位置\运输明细表.xlsx"), null, true)[Data]{0}),
- Custom1 = Table.NestedJoin(Source,List.Range(Table.ColumnNames(Source),1,3),pricelist,List.FirstN(Table.ColumnNames(pricelist),3),"补贴单价",JoinKind.LeftOuter),
- Custom2 = Table.ReplaceValue(Custom1,each [补贴单价],each [#"货物重量-吨位"],(x,y,z)=>List.Last(Table.SelectRows(y[n]{0},each [Column1]<=z)[Column2]),{"补贴单价"}),
- Custom3 = Table.AddColumn(Custom2,"补贴总价",each [#"货物重量-吨位"]*[补贴单价]),
- #"Changed Type" = Table.TransformColumnTypes(Custom3,{{"装货日期", type date}})
- in
- #"Changed Type"
复制代码 |
|