2 Replies Latest reply on Feb 24, 2017 9:36 AM by Bernard Chang

    Inner join alternatives?

    Bernard Chang

      Hi there

       

      I run into this simple question wondering what is the most efficient way to solve it.

       

      I am trying to determine if the value of a data field has a match in another data field.  Here is an example

       

      I am trying to tell if any employee names appear as a vendor.  For instance Ivan appears as Employee in row #3 and Vendor in row#5, thus a match. What is the easiest way to flag either/both row #3 and 5?

       

      I know this problem can be solved by data modeling or joining table, however it requires quite a bit of manual work.  I tried using sets to solve it however I couldn't manage to apply sets from one field to another.

       

      Would love to hear your thoughts.  Many Thanks.

      Bernard

        • 1. Re: Inner join alternatives?
          Peter Galimutti

          Hi Bernard,

          From data base perspective it's called self join. You would do a left join to the same table with different alias and join employee with vendor. What Tableau can do is it will match row to row, but not scan entire list of vendors and determine if one employee matches at least one vendor or vice versa.

           

          Instead of data modeling or joins outside tableau here is what you can do

           

          1. Duplicate the datasource.

          2. Left join  two tables with keys being employee and vendor

          3. Create a calculated field Employee (from left table)=vendor (from right table)

          If it is a match it's true.

          I have created a workbook with sample data on Tableau Public. You may ignore If you have already tried this.

          https://public.tableau.com/views/selfjoin/selfjoin?:embed=y&:display_count=yes

           

          1 of 1 people found this helpful
          • 2. Re: Inner join alternatives?
            Bernard Chang

            Thanks Peter for replying this question.  What you answered is the table join approach I was referring to. 

            Since there is no other answers, it seems like this is the only way to solve this problem.