3 Replies Latest reply on Apr 27, 2018 5:57 AM by nikher verma

    How to join more than 2 table in Tableau

    Tulu Sahoo

      Hi,

      I want to join 4 datasources in tableau.

      • table_1 - case_no.

                          case name

      • table_2 - case_no.

                          case_year

                          case_qtr

      • table_3 - case_no.

                          case_year

                          case_qtr

      • table_4- case_year

                          case_qtr

       

      joining query :

       

      SELECT T1.CASE_NO,T1.CASE name,T11.CASE _NO,T12.CASE_NO

      FROM TABLE_1 T1

      LEFT OUTER JOIN

       

      (SELECT DISTINCT CASE_ID FROM TABLE_2 T1 JOIN TABLE_4 T2 ON T1.CASE_YEAR=T2.CASE_YEAR AND T1.CASE_QTR=T2.CASE_QTR

      ) T11 ON T1.CASE_NO=T11.CASE_NO

      LEFT OUTER JOIN

       

      (SELECT DISTINCT CASE_NO FROM TABLE_3 T1 JOIN TABLE_4 T2 ON T1.CASE_YEAR=T2.CASE_YEAR AND T1.CASE_QTR=T2.CASE_QTR

      ) T12 ON T1.CASE_NO=T12.CASE_NO

       

       

      Please share the join mapping screenshot done in tableau.

        • 1. Re: How to join more than 2 table in Tableau
          kumar bharat

          Hi Tulu,

          What is your business req? you want data from which table.

          There are diff kinds of joins like left outer ,right outer etc.

          please elaborate your business requirement more.

          BR,

          bharat

          • 2. Re: How to join more than 2 table in Tableau
            Tulu Sahoo

            Please go through the joining query which i mentioned you will get idea how i want to join these 4 tables.

            • 3. Re: How to join more than 2 table in Tableau
              nikher verma

              Hi Tulu Sahoo ,

               

              Custom SQL Query for tableau is case sensitive , you should keep in your mind while writing your query .

               

              • table_1 - case_no. ,case_name
              • table_2 - case_no,case_year, case_qtr

                                 

              • table_3 - case_no.,case_year,case_qtr

                                 

              • table_4- case_year ,    case_qtr

               

              Assuming all your field\attributes  are in small case .

               

              SELECT T1.case_no ,T1.case_name,T11.case_no ,T12.case_no

              FROM table_1 T1  ............. and so on.

               

              Try to write it like this .

               

              And in these kind of scenarios when you are not sure about the problem with your query

               

              try using Preview results and first write down the basic query and only combine them to make a complex one once you are getting the results for your basic queries .

               

               

              -Nikher Verma