在MQuery中,我试图创建一个自定义列。如果另一列的值为1到5,则新列中的值为文本。它给了我令牌其他预期错误。
=if[#"Chair Independence Level"] = "1" then "Same Product Line"
else if[#"Chair Independence Level"]= "2" then "Different Product Line"
else if[#"Chair Independence Level"]= "3" then "Different Business Area"
else if[#"Chair Independence Level"]= "4" then "Different Sector"
else if [#"Chair Independence Level"]= "5" then "Not an Employee"
有人知道如何解决该问题,或者我应该将代码更改为什么?
答案 0 :(得分:1)
Power查询中的IF条件需要用ELSE语句限制。只需添加ELSE,您就应该做好了准备:
=if[#"Chair Independence Level"] = "1" then "Same Product Line"
else if[#"Chair Independence Level"]= "2" then "Different Product Line"
else if[#"Chair Independence Level"]= "3" then "Different Business Area"
else if[#"Chair Independence Level"]= "4" then "Different Sector"
else if [#"Chair Independence Level"]= "5" then "Not an Employee"
else "NA"
如果“主席独立级别”字段为数字,则:
=if[#"Chair Independence Level"] = 1 then "Same Product Line"
else if[#"Chair Independence Level"]= 2 then "Different Product Line"
else if[#"Chair Independence Level"]= 3 then "Different Business Area"
else if[#"Chair Independence Level"]= 4 then "Different Sector"
else if [#"Chair Independence Level"]= 5 then "Not an Employee"
else "NA"
答案 1 :(得分:1)
您正在处理powerby的mQuery方面,因此没有DAX。
您缺少最后一个else语句:
else if [#"Chair Independence Level"]= "5" then "Not an Employee" ELSE "the other"