Unioning Data
Use a union operation to create a new sheet containing all the records from two compatible source sheets. In order to be included in a union sheet, source sheets must have identical column types with the exception that one sheet can be wider than the other. All columns not present in the narrower sheet are defaulted to null in the result sheet. The initial column names are populated with the names from wider sheet. You can't union a sheet with itself.
This operation is similar to a SQL UNION ALL operation in that it provides all records from the source sheets and not a distinct set like the SQL UNION operation. It doesn't merge identical records from the source sheets.
Creating a Union Sheet#
To create a union:
- From the Data menu, select Union or click the Union icon on the toolbar.
- Select the sheets you want to union.
- Click Create Union.
Union Example#
Let's say you have a Workbook containing two datasource sheets from the same logical datasource, one with an older schema than the other. To run further analytics on the entire dataset you can create a union sheet which contains all data from both sheets.
The first datasource sheet could look like this:
The second datasource sheet has the following structure:
The source sheets have identical column types for all existing columns. The resulting union sheet contains null values in status
and bytesSent
columns for all records coming from the narrower sheet.
Clicking the Union icon opens a window where you can select the source sheets for the union sheet.
INFO: The 'Create Union Sheet' dialog can be closed with the 'ESC' tab.
After selecting the source sheets, click Create Union Sheet to create the union sheet:
You can now run your analysis on the complete data set.