6 Replies Latest reply on Mar 11, 2019 12:46 AM by Vibhakar Jha

    how works left join in tableau prep 2019.1?

    edgar hernandez

      i try to do a left join, the first table has 5136 rows and the second has 1159, but the result is 5189, but instead would to be 5136 rows with coincidence from the second table correct it?

        • 1. Re: how works left join in tableau prep 2019.1?
          Jim Dehner

          hi

          with the left join all the rows in the left table will be in the output and only the rows in the right table that match will be joined in the output

          if you just want the rows that match use an inner join

           

          Jim

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          • 2. Re: how works left join in tableau prep 2019.1?
            edgar hernandez

            i want all the rows in the left table with the rows in the right table that match, it´s for that, that i think the result would be 5136 rows instead 5188 rows.

            • 3. Re: how works left join in tableau prep 2019.1?
              Joshua Milligan

              Edgar,

               

              You are likely getting some duplication of rows.  In your example above you get 50+ extra rows and I suspect it's because rows on the left are finding multiple matches on the right.

              To illustrate, consider these two tables:

               

              Table 1:

               

              IDValue
              A1
              B2
              C3

               

              Table 2:

               

              IDColor
              ARed
              BBlue
              BBlack
              CGreen

               

              If you left joined on ID and Table 1 was your left table, then you'd get the following Rows:

               

              IDValueColor
              A1Red
              B2Blue
              B2Black
              C3Green

               

              So you'd end up with 4 rows even though your left table only had 3. 

               

              You'll need to make sure that the right table doesn't contain duplicate key values for the match (Fecha and Hora) in your example.  You can potentially use an aggregation prior to the join to fix that, but it might depend a bit on your original data.

               

               

              On a related note, notice that NULL values never match, so if you did want to retain them from the left side, you'll need to change them to another value first.

               

              Hope that helps!

              Joshua

              • 4. Re: how works left join in tableau prep 2019.1?
                Johannah Villa

                A true left join should be take all the rows in my left table and match to my right if it does not match put a null row. I am working with another customer who is saying that the left join is not working properly in Prep and based on this example above.. I agree with original question if you have 5000 rows in Left table... you should get a result of 5000 rows in your result set. Prep seems to be inflating the results, when it should not. Please advise.

                • 5. Re: how works left join in tableau prep 2019.1?
                  edgar hernandez

                  Hi Johannah Villa,

                   

                  In my case it was because i contained duplicate key values, you´ll need to make sure that. i think that is the mistake.

                   

                  Hope that helps.

                  • 6. Re: how works left join in tableau prep 2019.1?
                    Vibhakar Jha

                    Hey,Johannah Villa

                    These happen due to having a repeated value in column of the secondary table

                    in which you apply to join . Make sure their no repeated values.

                     

                    On Sat, Mar 9, 2019 at 7:56 AM Johannah Villa <tableaucommunity@tableau.com>