Table of contents
TOC
Collapse the table of content
Expand the table of content

UNION Function (DAX)

Owen Duncan|Last Updated: 10/5/2018
|
1 Contributor

Creates a union (join) table from a pair of tables.

Syntax

UNION(<table_expression1>, <table_expression2> [,<table_expression>]…)  

Parameters

TermDefinition
table_expressionAny DAX expression that returns a table.

Return Value

A table that contains all the rows from each of the two table expressions.

Remarks

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.

Example

The following expression creates a union by combining the USAInventory table and the INDInventory table into a single table:

UNION(UsaInventory, IndInventory)

USAInventory

CountryStateCountTotal
USACA5500
USAWA10900

INDInventory

CountryStateCountTotal
INDJK20800
INDMH251000
INDWB10900

Return table

CountryStateCountTotal
USACA5500
USAWA10900
INDJK20800
INDMH251000
INDWB10900
© 2018 Microsoft