KNOWLEDGE BASE

Converting a Connection to Custom SQL


Published: 12 Nov 2014
Last Modified Date: 26 Jul 2018

Question

How to convert a connection to a table or joined tables into a custom SQL query in Tableau Desktop

Environment

Tableau Desktop

Answer

Option 1: When connecting to data sources that support SQL connections

  1. Connect to the data source.
  2. Drag at least one table into the canvas area.
    • Optional: Drag additional tables into the canvas area to create joins.
  3. Navigate to Data > Convert to Custom SQL

Option 2: When connecting to Excel

  1. Connect to Excel with the legacy data connector
    1. Connect to the file.
    2. In the Open dialog box, click the Open drop-down menu, and then select Open with Legacy Connection
  2. Drag at least one table into the canvas area.
    • Optional: Drag additional tables into the canvas area to create joins.
  3. Navigate to Data > Convert to Custom SQL

Additional Information

Note: The Convert to Custom SQL option may be grayed out or missing if the data source does not support a SQL connection, or if there is a cross-database join in the canvas area. For Excel and text file data sources, this option is available only in workbooks that were created before Tableau Desktop 8.2 or when using Tableau Desktop on Windows with the legacy connection.
Did this article resolve the issue?