1.创建空白EXCEL文档,点击-启动编辑器
2.点击-视图,点击-高级编辑器
3.输入函数
let Profit = (Revenue, Cost)=>
Revenue-Cost
in Profit
解释
Line 1 of the code tells Power Query that this is a function called Profit,
requiring two parameters. For clarity, the two parameters are named
Revenue and Cost, though Power Query doesn’t care what you name
them as long as the names start with a letter and have no spaces.
• Line 2 in the code essentially tells Power Query to subtract the Cost
parameter from the Revenue parameter.
• Line 3 of the code tells Power Query to return the result.
4.关闭上载
5.加载数据源,选择文本
6.启动编辑器
7.点击-添加列,-自定义列
8.输入函数
= FunctionProfit([UnitPrice], [UnitCost])*[Quantity]
9.点击OK应用