Tableau 自定义 SQL 未按预期工作

Tableau Custom SQL Not Working As Expected

我是 Tableau 的新手,hoping/expecting 我可以从 DB2 导入 SQL 以最初引入并编译可视化。我有一个 db2 连接,然后转到自定义 sql,但之后没有加载任何内容。代码不是很复杂,但我确实有一些案例陈述。我尝试过 if then 但这似乎并没有给我 sql 的作用。主要问题是我有一个字段需要从两个不同的日期提取,然后只显示这两个日期不相同的结果。在 Tableau 中使用以下查询是否可行?

SELECT 
    RMD.ISSUE_ID,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.ISSUE_TITLE END) AS CURR_ISSUE_TITLE,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.MEMBER_IMPACT END) AS CURR_MEMBER_IMPACT,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-08' THEN CURRENT.MEMBER_IMPACT END) AS PREV_MEMBER_IMPACT,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.ISM_STATUS END) AS CURR_ISM_STATUS,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.ISSUE_OWNER_ORG END) AS CURR_ISSUE_OWNER_ORG,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.ISSUE_OWNER END) AS CURR_ISSUE_OWNER,
    MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.ISSUE_APPROVER END) AS CURR_ISSUE_APPROVER
FROM LOD.ISM_ISSUE_SUMMARY_HIST_WKY CURRENT INNER JOIN
     LOD.RMD_ISS_REMED_SUMMARY RMD
     ON CURRENT.ISSUE_ID = RMD.ISSUE_ID
WHERE AS_OF_DATE IN ('2021-08-08', '2021-08-15') 
GROUP BY RMD.ISSUE_ID
HAVING MAX(CASE WHEN AS_OF_DATE = '2021-08-08' THEN CURRENT.MEMBER_IMPACT END) <> MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.MEMBER_IMPACT END) ;

我试过写这篇文章,但似乎没有做任何事情,因为它只是查询的一部分,或者我不知道如何完成它以完成完整的查询。

IF [As Of Date] = #2021-08-15# THEN [Issue Title] ELSEIF  

 [As Of Date] = #2021-08-15# THEN [Member Impact] ELSEIF

 [As Of Date] = #2021-08-08# THEN [Member Impact] ELSEIF

 [As Of Date] = #2021-08-015# THEN [Ism Status] ELSEIF

 [As Of Date] = #2021-08-015# THEN [Issue Owner Org] ELSEIF

 [As Of Date] = #2021-08-015# THEN [Issue Owner] ELSEIF 
 
 [As Of Date] = #2021-08-015# THEN [Issue Approver] END

是否可以只在 Tableau 中引入我的查询?

如果删除分号(“;”),查询是否有效?