title: Tableau Custom SQL Not Working As Expected
body: <p>I am new to Tableau and was hoping/expecting that I could import SQL from DB2 to initially pull in and compile a visualization. I have a db2 connection and then go to custom sql but nothing loads after that. The code is not very complex but I do have some case statements. I tried doing if then but that doesn't seem to give me what the sql does. The main issue is I have a field I need pulled from two different dates and then only show the results that are not the same for those two dates. Is this possible in Tableau with this below query?</p>
  <pre><code>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) &lt;&gt; MAX(CASE WHEN AS_OF_DATE = '2021-08-15' THEN CURRENT.MEMBER_IMPACT END) ;
  </code></pre>
  <p>I tried writing this but doesn't seem to do anything as its just a piece of the query that or I dont know how to finish it to complete the full query.</p>
  <pre><code>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
  </code></pre>
  <p>Is it possible to just bring in my query within Tableau?</p>