Updated May 22, 2023
Introduction to Tableau Union
Tableau union is used to append the two or more tables by different options. Here the tables to be combined should be present in the same data connection linked to the same data source. If the data source manages union, the other new union option is viewed in the left pane of the data source once it is connected to the data.
What is a Tableau Union?
In simple, a tableau union is used to join multiple tables that are present under the same data source and connection. Supported connectors have various functions between tableau online, tableau server, and tableau desktop. If the data source works on the union option, it is present in the left end pane on the data source site once the data connection is established. To achieve the preeminent result, the tables to be combined under the union option should have a similar structure. Every table should have the same count of fields and an associated field that has the matching data type and field names.
How to Use the Tableau Union Database?
The tables are unioned using the wildcard search option in the tableau database or desktop.
To implement this method, use a character in the wildcard, that is, asterisk * that fits the pattern or sequence of the array in the worksheet names, excel workbook, text files, .pdf files, JSON files, google sheets, and database tables.
Click on the New union option to establish a union on the data source page.
Select the wildcard automatic option in the union dialog box.
Include: Select the search option if the user prefers to find the tables that should be included in the union. For example, the user can give * 2017 in the Include option in the excel sheet, ending with 2017 in the names. The search option gives the output as all the months present under 2017 from the selected or linked connection. Then choose to apply to get results.
Include and Expand a search to subfolders: If the user enters *2017 in the include option and selects the expand a search to subfolders in the check box, it looks at all the excel sheets under the name of 2017 in the current folder, and it extends its search in the worksheets that ends with 2016 in the additional worksheet present in the subfolder also.
Include and Expand Search to the Parent Folder: If the user enters *2017 in the include option and chooses to expand a search to the parent folder, it displays the name with 2017 in the current folder, then gives the additional sheets in the subfolder, then looks all the parallel workbook and displays all the files with 2017.
Include and Expand a Search to the Subfolders along with Expanding a Search to the Parent Folder: If the user enters *2017 in the include option and chooses both the expand a search to the subfolders along with expanding a search to the parent folder, it looks for all the worksheets in the current folder, then it goes for the related fields in the subfolder, then it extends the search in all the parallel folder and gives the result.
Tableau Union Editing
Tableau has three important functions under union that enable the user to perform rename a union, modify or customize a union and remove a union.
1. Rename a Union
- Right-click on the logic table where the unioned data is present.
- On the physical layer, click twice on the union table.
- Give a suitable name for the union table.
2. Modify a Union
The user can customize a union by removing or adding tables by using the below steps.
- In the unioned data, the logic table should be double-clicked.
- Choose the edit union option from the drop-down arrow in the union.
- If the user wants to remove the table, he can hover on it and remove it accordingly. If he wants to add a new table, he can drag a table from the data source page.
- Choose ok once all modifications are done.
3. Remove a Union
Double click on the logic table in the unioned data and choose remove from the drop-down arrow.
Merge a mismatched name in union:
- When the table column is not matched in the union, it adds zero values in the resultant table.
- Choose the columns which need to be merged.
- In the column drop-down option, choose merge mismatched fields.
Example of Tableau Union
Below are the simple functions by tableau union that works under the database.
- Join option can be used in the table that is unioned.
- Two unioned tables can be combined again with the join option.
- Union generates mandatory fields like table name and sheet, which can be used with the join key.
- If the name range is present in the union, zero values are viewed in the sheet field.
- The field option that emerged from merge can be changed and used as a pivot, split, or join key.
- In tableau desktop, when the user has to work in Excel, he can use wildcard search to include the name ranges, but it gets excluded from the tables when data is interpreted.
- To combine the JSON file using union, it should have .log extension or .txt, or .json format.
- When the user implies wildcard search to combine files in .pdf, the output is placed in the initial .pdf file.
Hence, the user can use the tableau union option and combine all his files in the same database source. When the user works on the database, he can customize the union to a structured query.
This is a guide to Tableau Union. Here we discuss the introduction, and how to use the tableau union database? editing an example. You may also have a look at the following articles to learn more –