3 Replies Latest reply on Oct 31, 2016 6:53 AM by Katie Bueno

    Using SQL Queries in Tableau (Beginner Tableau User)

    Katie Bueno

      I am the first analyst to begin the journey of using Tableau to display reports for the Department. Prior to Tableau, the Department has only used SQL to create reports that ran through SSRS which required very detailed SQL script. Now that we are moving on from SSRS to Tableau, I am wondering to what extent does the SQL/Tableau users write SQL scripts to create reports in Tableau. It appears that features in Tableau can do the majority of things that otherwise would have needed to be written in SQL script when using SSRS to produce a report.


      Do you prepare the majority of your report in SQL and then design results in Tableau? Is a simple data pull enough that Tableau can manipulate/ add parameters to the dataset?


      What is best practice for wanting to go back and edit certain attributes to a report? Would it be easier to edit a SQL query than edit a report made completely in Tableau?


      Thank you for all advice in advance!



        • 1. Re: Using SQL Queries in Tableau (Beginner Tableau User)
          Dmitry Chirkov

          Hi, Katie


          Answer will depend on how sophisticated your SQL scripts are.

          Tableau only supports single statement SELECTs so simply grabbing existing SQL script and sticking it into Tableau might not work.


          Longterm it's up to you - all depends on what sort of people would you expect take over. Creative analysts or not-so-creative-developers (like me!)


          I recommend reading this: Best Practices for Designing Efficient Tableau Workbooks, the V10.0 edition | The Last Data Bender

          Alan has a section on Custom SQL there - see page 64.

          1 of 1 people found this helpful
          • 2. Re: Using SQL Queries in Tableau (Beginner Tableau User)
            Nikunj Bhardava

            Hi Katie,


            Initially, I also started report development in SSRS with deep SQL queries/procedure knowledge to prepare data for SSRS reports. It helped me a lot in tableau


            Regarding SQL importance while using any reporting tool


            Knowledge of SQL Script is added advantage when using tableau as reporting tool, definitely tableau has great capabilities of handling queries in back-end by simple drag and drop fields to the rows/columns but to actually understand what query tableau runs behind the scene is very crucial.


            So if you are having strong SQL script/query knowledge then you can easily understand tableau behavior and think yourself if you need to create any custom charts or calculations.


            Ideally as per my thinking we must have SQL script/queries expertise before exploring or using any reporting tool because behind the scene every tools are rely on the queries to generate chart and everything.


            Tableau Specific Development


            Well, tableau have strong ability to prepare your data as well if your data has some king of redundancy, un-formatted data, unstructured data when connecting any data-source to it. it always batter to have prepared data before using it to the tableau, so whatever data coming from the source should be pre-processed using different data-warehousing techniques like creating cube, normalization of database..


            Generally, if we have core/detailed data from the source then we can easily create calculations within the tableau as per our requirements. we don't need to write query our-self for each new requirement/functionality. but yes definitely we need to prepare data in such a way that we can have detail data from which we can achieve all our expected functionalities.


            My practice with our client


            - In my case with our clients we are initially analyse the whole requirement and then checking the feasibility within the tableau for that requirement and then creating one common data-source for whole the dashboard and publish it to the tableau server. and finally using that global data-source in tableau report.


            - Will definitely have some changes in requirement while in development, so if any requirement doesn't meet with existing data-source then we need to think SQL queries. i.e may be we need to add extra joins using custom SQL that will brings up necessary data in tableau.


            Hope this helps!




            1 of 1 people found this helpful
            • 3. Re: Using SQL Queries in Tableau (Beginner Tableau User)
              Katie Bueno

              Thank you very much for breaking this down for me, Nikunj. This helps a lot!