Returns the union of the specified member sets.
Query
UNION(
{[Geography].[Geo].[United States]},
{[Geography].[Geo].[Switzerland]}
)
Result
{
[Geography].[Geo].[Country].[United States],
[Geography].[Geo].[Country].[Switzerland]
}
Assertion : MDX Equals
{[Geography].[Geo].[United States]} + {[Geography].[Geo].[Switzerland]}
Assertion : MDX Equals
{[Geography].[Geo].[United States],[Geography].[Geo].[Switzerland]}
Returns the union of the specified member sets.
Query
UNION(
{([Product].[Prod].[Corporate],[Geography].[Geo].[Spain])},
{([Product].[Prod].[Corporate],[Geography].[Geo].[Switzerland])}
)
Result
{
( [Product].[Prod].[Licence].[Corporate], [Geography].[Geo].[Country].[Spain] ),
( [Product].[Prod].[Licence].[Corporate], [Geography].[Geo].[Country].[Switzerland] )
}
Assertion : MDX Equals
{([Product].[Prod].[Corporate],[Geography].[Geo].[Spain])}
+
{([Product].[Prod].[Corporate],[Geography].[Geo].[Switzerland])}
Assertion : MDX Equals
[Product].[Prod].[Corporate] * {[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland]}
Union, as well as the + operator, will remove duplicated elements from resulting set.
Query
UNION(
{[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland]},
{[Geography].[Geo].[Spain]}
)
Result
{
[Geography].[Geo].[Country].[Spain],
[Geography].[Geo].[Country].[Switzerland]
}
Assertion : MDX Equals
{[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland]}
Assertion : MDX Equals
{[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland]} +
{[Geography].[Geo].[Spain]}
Using the ALL parameter will return the union of the sets including duplicates.
Query
Union(
{[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland]},
{[Geography].[Geo].[Spain]},ALL
)
Result
{
[Geography].[Geo].[Country].[Spain],
[Geography].[Geo].[Country].[Switzerland],
[Geography].[Geo].[Country].[Spain]
}
Assertion : MDX Equals
{[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland],[Geography].[Geo].[Spain]}
Union function can add a variable number of sets; in our example three sets.
Query
Union(
{[Geography].[Geo].[Spain]},
{[Geography].[Geo].[Switzerland]},
{[Geography].[Geo].[United States],[Geography].[Geo].[France]},
ALL)
Result
{
[Geography].[Geo].[Country].[Spain],
[Geography].[Geo].[Country].[Switzerland],
[Geography].[Geo].[Country].[United States],
[Geography].[Geo].[Country].[France]
}
Assertion : MDX Equals
{[Geography].[Geo].[Spain],[Geography].[Geo].[Switzerland],
[Geography].[Geo].[United States],[Geography].[Geo].[France]}
Returns an error if applied to set of different dimensionality, members of both set are not of the same hierarchy.
Query
UNION( [Geography].[Geo].members, [Geography].[Economy] )
Result
Returns an error if applied to set of different dimensionality, there is a mismatch on tuples hierarchies.
Query
UNION(
{ ( [Geography].[Geo].[Spain], [Time].[Calendar].[2010] ) },
{ ( [Time].[Calendar].[2010] , [Geography].[Geo].[Spain] ) }
)
Result
Error Code : OLAP_INVALID_TUPLE_DIMENSIONALITY
Error Message : invalid tuple dimensionality '[Geography].[Geo],[Time].[Calendar]' - '[Time].[Calendar],[Geography].[Geo]'