google Data Studio 计算字段的条件语句

google data studio conditional statement on calculated field

我正在使用 google 数据工作室,我正在尝试使用 case 语句创建计算字段,但它不起作用。指标是销售额。下面是示例行:

CASE WHEN SUM(sales) > 350000 THEN 1 ELSE 0 END

上面的公式给我一个错误。如果我改为执行下面的公式,它不会给出错误,但结果不是我所期望的:

CASE WHEN sales > 350000 THEN 1 ELSE 0 END

知道哪里出了问题吗?我也尝试使用 if 但没有成功。

我会创建两个计算字段。使用 CASE 语句在下一个计算字段中使用第一个计算字段:

计算字段 1:总销售额

SUM(sales)  

计算字段 2:MyCaseField

CASE WHEN Summed Sales > 350000 THEN 1 ELSE 0 END  

来自 Data Studio 文档:

...It's not possible to do math or use calculated field functions in a WHEN condition... ...You can work around this by first creating a calculated field with the desired formula. Then use that field in the CASE statement.

Reference