加入时的电源查询功能错误

时间:2016-05-18 14:57:17

标签: powerquery m

我收到此错误 有一个未知的标识符。你是否使用[field]速记来表示每个'之外的_ [field]?表达

我创建了下面的函数,该函数根据4个输入列的值映射新列。该函数适用于我应用它的表。但是,当我将表加入另一个表时,我收到上述错误。

该函数的所有输入都是文本列。如果有人对此有一些经验,那将是一个很大的帮助。

// FNStage1Transform

let Stage1 = (term,investment_universe,Risk_tolerance,Special) =>

let 
    Stage1Transform =

if List.Contains({"Short","Intermediate"},term) and List.Contains({"Short","Aggregate","Gov/Credit"},investment_universe ) then term
else if term ="Full" then 
 if investment_universe = "Treasury" then term&" "&  investment_universe 
 else if investment_universe ="TIPS" then "Full+Long"&" "&investment_universe 
 else if investment_universe ="Muni" and [Risk Tolerance] = "Conservative" then investment_universe 
 else if List.Contains({"Credit","Corp"},investment_universe) then "CredCorp"
 else investment_universe
else if term  = "Long" and  investment_universe ="TIPS" then "Full+Long"&" "&investment_universe 
else if term  = "Long" and List.Contains({"Credit","Corp"},investment_universe) then term &" "&investment_universe
else if investment_universe  = "Muni" and Risk_tolerance  = "Conservative" then investment_universe 
else if List.Contains({"Credit","Corp"},investment_universe) then term&" CredCorp"
else term &" "&  investment_universe,


Stage2Transform = if List.Contains({"High Beta","Transition"},Risk_tolerance) then Risk_tolerance 
else if Special = "Yes" then Stage1Transform &" "& Risk_tolerance & " Special"

else if Risk_tolerance = "Standard" then Stage1Transform
else Stage1Transform &" "&Risk_tolerance,


Stage3transform = "PS_"& Stage2Transform,



Result = Stage3transform 





in Result

in
    Stage1

1 个答案:

答案 0 :(得分:2)

如果您在代码中搜索[,则会发现错误:

else if investment_universe ="Muni" and [Risk Tolerance] = "Conservative" then investment_universe 

你想要

else if investment_universe ="Muni" and Risk_tolerance = "Conservative" then investment_universe