If Then语句-具有多个条件的Tableau

时间:2019-06-05 00:14:31

标签: tableau calculated-field tableau-public

如果,然后,具有两个字段的ElseIf语句,其中一个字段具有两个值为TRUE的

“销售线索年龄”和“销售线索状态”,其中两个状态都应该为真。尝试使用OR,尝试使用AND,并尝试添加括号。

IF [Lead Age] >3 AND [Lead Status] = "A. Open" THEN "Open"

ELSEIF ([Lead Status] = "B. Attempting to Contact" OR [Lead Status] = "C. Contacted") AND [Lead Age] >30 THEN  "Inactive"

ELSEIF ([Lead Status] = "B. Attempting to Contact" OR [Lead Status] = "C. Contacted") AND [Lead Age] <30 THEN  "Active"

ELSEIF [Lead Status] = "N. Nurture" OR [Lead Status] ="Disqualified" THEN  "Disqualified"

ELSE "Other"

END

预期结果->

如果“潜在客户状态”为“尝试联系”并且“潜在客户状态”也为“已联系”,则添加“潜在客户年龄”也是30天以上的两个状态

我也尝试了以下方法:

IF [Lead Status] = "N. Nurture" OR [Lead Status] ="Disqualified" THEN  "Disqualified"

ELSEIF ([Lead Status] = "B. Attempting to Contact" AND [MQL Age] >30) OR ([Lead Status] = "C. Contacted" AND [MQL Age] >30) THEN  "Inactive"

ELSEIF ([Lead Status] = "B. Attempting to Contact" AND [MQL Age] <30) OR ([Lead Status] = "C. Contacted" AND [MQL Age] <30) THEN  "Active"

ELSEIF ([Lead Status] = "A. Open" AND [MQL Age] >3) THEN "Open"

ELSE "Other"

END

1 个答案:

答案 0 :(得分:0)

以下条件对我有用:

如果([年龄]> 30并且 ([[主要状态] ='正在尝试联系'或[[主要状态] ='已联系')) '是' 其他 '没有' 结束

enter image description here