I am receiving errors when I use a CTE.
The SQL query runs without any issues in Microsoft SQL Server Management Studio.
Older posts in the Tableau community forum state that Tableau does not support CTE in Microsoft SQL. Is this still true in version 9.#?
Tableau (9 included) wraps the custom SQL statement to make it a subquery. This causes issues with the CTE.
If you have access, you can create a view in SQL Server that has the CTE and then pull directly from that instead.