UNION is a DAX function that returns the union of two or more tables with matching columns.
Syntax
UNION( [ Table, ... ] )
Argument | Properties | Description |
---|---|---|
Table | Repeatable | A table that will participate in the union. |
UNION is a DAX function that returns the union of two or more tables with matching columns.
UNION( [ Table, ... ] )
Argument | Properties | Description |
---|---|---|
Table | Repeatable | A table that will participate in the union. |
A table that contains all the rows from each of the two table expressions.
The two tables must have the same number of columns.
Columns are combined by position in their respective tables.
The column names in the return table will match the column names in table_expression1.
Duplicate rows are retained.
The returned table has lineage where possible. For example, if the first column of each table_expression has lineage to the same base column C1 in the model, the first column in the UNION result will have lineage to C1. However, if combined columns have lineage to different base columns, or if there is an extension column, the resulting column in UNION will have no lineage.
When data types differ, the resulting data type is determined based on the rules for data type coercion.
The returned table will not contain columns from related tables.
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
The following expression creates a union by combining the USAInventory table and the INDInventory table into a single table:
UNION(UsaInventory, IndInventory)
USAInventory
Country/Region | State | Count | Total |
---|---|---|---|
USA | CA | 5 | 500 |
USA | WA | 10 | 900 |
INDInventory
Country/Region | State | Count | Total |
---|---|---|---|
IND | JK | 20 | 800 |
IND | MH | 25 | 1000 |
IND | WB | 10 | 900 |
Return table,
Country/Region | State | Count | Total |
---|---|---|---|
USA | CA | 5 | 500 |
USA | WA | 10 | 900 |
IND | JK | 20 | 800 |
IND | MH | 25 | 1000 |
IND | WB | 10 | 900 |
Other functions related to UNION are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy