Specific unions
Let use multiple sheets with the same number of columns and same type of data in them.
I can union these three together simply by dragging them into the Data Pane one at a time. After adding the first one, the subsequent ones can be dragged beneath the first until the little orange box which reads “Drag table to union” appears.
Tableau will automatically append the rows onto the original, identifying matching fields by their shared name.
Caveat: Using the manual union restricts your data input to only within a single data connection. Attempting to bring in data from another connection will force it to become a join instead. You can use a wildcard union, detailed below, to side-step this limitation.
Wildcards unions
The second option for unions is by using a wildcard. Once the first sheet has been added to the Data Pane, click the drop down and convert it into a union. A new window will then appear, offering the choice of setting up either a specific union (as above) or a wildcard union.
This setting tells Tableau to look at specific sheets within a workbook, or at workbooks within a given directory and union together all the data that it finds. It can also be used to exclude specific sheets or workbook from the union as required.
But wait, my fields have different names!
In the example above, my air sheet has fields with the same data as land and sea, but with differing names. These field names are mismatched.
If fields have mismatched names, Tableau will create a new field, simply adding nulls to entries where no data exists for that field name.
This can be rectified by highlighting the mismatch fields and tell Tableau to merge them together. It will automatically name the new merged field as a combination of the two. The field can then be renamed to whatever is desired.
And there you have it, you now have all your data nicely brought together, ready to be visualised in Tableau!
Comments
Post a Comment