条件列Table.AddColumn(Power Query 之 M 语言)

数据源: 

       任意表

目标: 

       添加条件列

操作过程: 

  【添加列】》【条件列】》设置

      

M公式:  

  = Table.AddColumn( 表, "新列名", 函数, 数据类型)

    单一条件:each if [1] 2 3 then 4 else 5

      

 

     多重条件:each if [1] 2 3 then 4 else if [5] 6 7 then 8 else 9

      

示例:如果品名为A则返回生煎包,如果品名为B则返回小笼包,其他返回冬笋鲜肉烧卖

  if [品名] = "A" then "生煎包" else if [品名] = "B" then "小笼包" else "冬笋鲜肉烤卖"

posted @ 2021-12-30 19:13  熬肥妖  阅读(691)  评论(0编辑  收藏  举报