UNION
UNION('Node1', 'Node2' [, 'Node3', ...])
The UNION function combines the result sets of two or more input nodes into one output.
Use this function when you want to append non-overlapping result slices from nodes that share the same dimensional structure. UNION is a stricter version of ADDITION (+) and can serve as an extra guardrail because the inputs are required to have the same levels: UNION('Salary Q1', 'Salary Q2').
Parameters
- Node1Node referenceRequired
- First input node to combine
- Node2Node referenceRequired
- Second input node to combine
- Additional nodesNode referenceOptional
- Any number of additional input nodes to combine
Output shape
- Dimensionality
- Same as all inputs (they must all have the same levels).
- Level values
- Union of all level values from all inputs.
- Row count
- Sum of all input row counts. No aggregation or deduplication is performed.
Watch out
- All inputs must have the same levels.
- Inputs must not have overlapping rows. If any row key appears in more than one input, the calculation fails at runtime.
- The same node cannot appear more than once in the parameter list.
- All inputs must have the same unit.
Example
Appending non-overlapping slices
This example shows UNION combining two disjoint salary slices with the same level structure. Because the rows do not overlap, the result appends both slices into one output.
Input node: 'Node1'
| Year | Employee | Salary |
|---|---|---|
| 2025 | E1 | 50,000 |
| 2025 | E2 | 60,000 |
Input node: 'Node2'
| Year | Employee | Salary |
|---|---|---|
| 2026 | E1 | 55,000 |
| 2026 | E2 | 66,000 |
Formula: UNION('Node1', 'Node2')
| Year | Employee | UNION Result |
|---|---|---|
| 2025 | E1 | 50,000 |
| 2025 | E2 | 60,000 |
| 2026 | E1 | 55,000 |
| 2026 | E2 | 66,000 |
See also
- ADDITION (+)
- When overlap is allowed or expected, or when the inputs do not need UNION’s same-level and no-overlap constraints.
- ROLLUP
- When you need to change granularity or aggregate a node to different levels instead of combining disjoint result slices.