【发布时间】:2019-04-30 07:21:53
【问题描述】:
我写过:
case when [count_total_cre] <= 75 then (sum([count_total_cre])*15) else 0 end
这适用于 SQL。
当我尝试添加 Tableau 计算字段时出现以下错误:
语法错误(可能您缺少标识符)
我错过了什么?谢谢!
【问题讨论】:
标签: syntax-error case tableau-api
我写过:
case when [count_total_cre] <= 75 then (sum([count_total_cre])*15) else 0 end
这适用于 SQL。
当我尝试添加 Tableau 计算字段时出现以下错误:
语法错误(可能您缺少标识符)
我错过了什么?谢谢!
【问题讨论】:
标签: syntax-error case tableau-api
Tableau 的计算语言不允许在 case 语句中使用范围比较运算符。您需要在此处使用 if 语句。
if sum([count_total_cre]) <= 75 then (sum([count_total_cre])*15) else 0 end
请注意,您必须在两边都使用单个值或聚合表达式。以下也是有效的:
if [count_total_cre] <= 75 then [count_total_cre]*15 else 0 end
你使用哪一个取决于你的最终目标。
如果您好奇,Tableau 中的案例格式如下:
case [Sales]
when 75 then [Sales]*15
when xx then yy
else zz
end
【讨论】: