Skip to main content
Rishi Saka (TCS) a posé une question dans #Tableau Prep

Hi All,

 

Will need advise on Joins and Unions. I have taken multiple datasources and joined it in Tableau. Now I wish to union the joined tables with itself. Is it possible? Or do I have to do it in Prep and then after I publish the data source then do the union to itself? 

 

For example if I have joined the below tables and call the final table 'Returndetails',  is it possible the make a union of 'Returndetails' to itself? The final union should have an auto populated column [Table Name] with half of the rows having alias as "Returndetails.txt1" and the other half as "Returndetails.txt". If it is not possible can I please get an alternate way to achieve this. 

 

Thank you

 

Regards,

RS

 

Union a set of joined tables to itself

3 réponses
  1. 5 janv. 2020, 02:18

    Definitely easier to do in Prep, but can be done in Desktop too. Instead of doing a union, I'd suggest another join. For example, using Superstore, I could do something like what you have above.

    Definitely easier to do in Prep, but can be done in Desktop too. Instead of doing a union, I'd suggest another join. For example, using Superstore, I could do something like what you have above.

    Next I can create another table (in Excel or CSV or whatever) that looks like this:

     

    Table NameReturn Details 1Return Details 2

     

    You can then add that in as a data source.

    pastedImage_2.png

    Then perform a cartesian join (or cross-join) to the other tables using join calculations where both sides are 1.

    pastedImage_6.png

    You'll now have two duplicate sets of data.

    pastedImage_7.png

    See attached.

0/9000