QBoard » Advanced Visualizations » Viz - Tableau » SQL Code to Tableau

SQL Code to Tableau

  • I'm very new to tableau, and would like to know how to convert this SQL to tableau.

    select  case when RD = 1 then 'RD' 
                 else 
                    case when Claim_FeatureStatus <> 'Re-opened' 
                              and subro_only = 0 
                              and SIU=0 
                              then 'Open' 
                         when Claim_FeatureStatus = 'Re-opened' 
                              and subro_only = 0  
                              and SIU = 0 
                              then 'Re-Opened'
                         when SIU = 1 
                              then 'SIU'
                         else 'Subrogation'
                    end              
              end as ClaimStatus
      December 9, 2021 1:03 PM IST
    0
  • To rephrase your question you are looking to utilize the dataset returned by this sql query for analytics in Tableau.

    Here is what needs to be done - 1) Connect to this SQL DB and create a datasource using 'custom sql' option 2) Go to your sheet and start visualizing this data

    However your query is not complete so above will be difficult to achieve

      January 1, 2022 1:57 PM IST
    0
    1. Start Tableau and under Connect, select Microsoft SQL Server. For a complete list of data connections, select More under To a Server. Then do the following:

      1. Enter the name of the server you want to connect to.

        To connect to a non-default port, use the <server name>, <port number> format when entering the server name. For example, ExampleServer, 8055.

      2. (Optional) Enter a database name if you want to connect to a contained database.

      3. Select how you want to sign in to the server. Specify whether to use Windows Authentication or a specific user name and password. If the server is password protected, and you are not in a Kerberos environment, you must enter the user name and password.

        Select the Require SSL check box when connecting to an SSL server.

      4. Specify whether to Read uncommitted data. This option lets Tableau running at the read-uncommitted isolation level. Long queries from other transactions, including extract refreshes, can lock the database and delay Tableau's transactions. Select this option to allow queries to read rows that have been modified by other transactions even when they have not been committed yet. When this option is cleared, Tableau uses the default isolation level specified by the database.

      5. (Optional) Select Initial SQL to specify a SQL command to run at the beginning of every connection, such as when you open the workbook, refresh an extract, sign in to Tableau Server, or publish to Tableau Server. For more information, see Run Initial SQL.

      6. Select Sign In.

        If Tableau can't make the connection, verify that your credentials are correct. If you still can't connect, your computer is having trouble locating the server. Contact your network administrator or database administrator.

    2. On the data source page, do the following:

      1. (Optional) Select the default data source name at the top of the page, and then enter a unique data source name for use in Tableau. For example, use a data source naming convention that helps other users of the data source figure out which data source to connect to.

      2. From the Database drop-down list, select a database or use the text box to search for a database by name.

      3. Under Table, select a table or use the text box to search for a table by name.

        You can also specify a stored procedure in the database. For more information about stored procedures, including a list of constraints specific to SQL Server databases, see Use a Stored Procedure.

      January 4, 2022 1:18 PM IST
    0