During my Corporate Tableau Training in Gurgaon , i get questions many time regarding Unions in Tableau . For Corporate training and Online Training contact at firstname.lastname@example.org
So Today we would like to Quickly go through a use case explaining the “Union” introduced in Tableau . Once again we take the “Sample Super Store” data set and make changes accordingly so as to understand the concept. The Reason we always take “Sample Super Store” to explain the concept is, everyone is familiar with the data set so we do not waste our time exploring and explaining the Data.
In order to understand “Union” in the easiest way, let us consider the scenario that rather than having all the Customer related Order data in “Orders” tab of sample Super store, say we have multiple sheets containing the details about the Orders of each customer.
For e.g. the below excel has different sheet with the name of customers and the different sheets contains the details about the Customers. So the Data is not all present in one file rather the data is split into Little files and you need to do the analysis. Tableau Union helps you to piece together data that has been split into little files.
First Sheet contains “Orders Data for Customer Aaron Bergman”
[ email@example.com ]
Second sheet contains “Orders” data for customer “Aaron Hawkins”.
Now in such scenario, if we want to do the analysis on complete data set , Union comes as a Handy tool introduced in Tableau
Once you connect to Super Store Customer Data from Tableau , you will have the below screen
You cannot create a Join here because it is the same Data for different customers. So Before Tableau , you would have to copy and paste all the related Customer Data in a single excel sheet to do your analysis. But now you can just use the “union” and drag and drop all the different sheets to do your analysis.
So Double Click on “New Union” and using shift button select all the customer orders data and drag it to the Union window
Click on “Ok” and now you will have Data from all the different customer excel sheet at one place to do your analysis.
One more thing that needs to be noted here is at the end of all the columns, you can see a column that Tableau created “Table Name”, this essentially contains the name of the file from which each row originated.
So Now you can go to your worksheet and do your analysis as if this was one single file without any copy paste workaround.
You can find a similar question on Tableau Community – https://community.tableau.com/message/523550#523550