In snowflake the below code "SQL compilation error: syntax error line 4 at position 7 unexpected 'DATE_TRUNC'. syntax error line 4 at position 41 unexpected ')'. Query as follows:  SELECT * FROM
CASE
  -- Condition 1: If there is a FET.Escalation_number that was opened on the same day as M.S1_REFERENCE_REPORT_DATE and fet.DATE_CLOSED is null
  WHEN DATE_TRUNC('WEEK', FET.DATE_OPENED) = DATE_TRUNC('WEEK', M.S1_REFERENCE_REPORT_DATE) 
      AND FET.DATE_CLOSED IS NULL THEN 'Open'
  -- Condition 2: If the FET.Escalation_number is closed during the same week, including the same Monday as M.S1_REFERENCE_REPORT_DATE
  WHEN DATE_TRUNC('WEEK', FET.DATE_CLOSED) = DATE_TRUNC('WEEK', M.S1_REFERENCE_REPORT_DATE) 
      AND FET.DATE_CLOSED IS NOT NULL THEN 'No Open Excess Escalation'
  -- Condition 3: If fet.DATE_OPENED and fet.DATE_CLOSED are both null
  WHEN FET.DATE_OPENED IS NULL AND FET.DATE_CLOSED IS NULL THEN 'No Open Excess Escalation'
  -- Default condition: Set as null for any other cases
  ELSE 'No Open Excess Escalation'
  AS "FET_STATUS"
                MDSP_ANALYTICS_SV.POAN_SUCESS_RATE AS M
                LEFT JOIN
                                (
                                          SELECT *
                                          FROM
                                                    MDSP_GLBMDSS_USER_V.VW_ESCALATION_REPORT AS F
                                                    LEFT JOIN
                                                              MDSP_GLBMDSS_USER_V.D_DATE AS D
                                                              ON
                                                                        COALESCE(F.DATE_OPENED,CURRENT_DATE()) = D.RECORD_DATE
                                          WHERE
                                                    F.ESCALATION_TYPE = 'RETURN EXCESS ESCALATION'
                                                    /*AND F.ESCALATION_STATUS in ('OPEN'
                                                                              , 'ON HOLD'
                                                                              , 'HALT')*/
                                )
                                AS FET
                                ON
                                                M.S1_COMP_ID                    = FET.COMP_ID
                                                AND M.S1_ITEM                   = FET.ITEM
                                                AND M.S1_REFERENCE_REPORT_DATE >= FET.CAL_WK_START_DATE Limit your response to 900 words.
user