Union

The MDX Union function for Essbase returns the union of two input sets, optionally retaining duplicates.

Syntax

Union ( set1, set2 [,ALL] )

Parameters

set1

A set to join with set2.

set2

A set to join with set1.

ALL

If the optional ALL keyword is used, duplicates are retained.

Notes

Duplicates are eliminated by default from the tail of the set. The optional ALL keyword retains duplicates. The two input sets must have identical dimension signatures. For example, if set1 consists of dimensions Product and Market, in that order, then set2 should also consist of Product followed by Market.

Example

Example 1

The expression

Union( Siblings([Old Fashioned]), {[Sarsaparilla], [Birch Beer]}) 

returns the set

{ [Old Fashioned], [Diet Root Beer], [Sarsaparilla], [Birch Beer] }

Example 2

The expression

Union( Siblings([Old Fashioned]), {[Sarsaparilla], [Birch Beer]}, ALL)

returns the set

{ [Old Fashioned], [Diet Root Beer], [Sarsaparilla], [Birch Beer],
      [Sarsaparilla], [Birch Beer] }

Example 3

The following query

SELECT
CrossJoin (
         Union (
            Siblings ([Old Fashioned]),
            {([Root Beer]), ([Cream Soda])}
         ),
         {(Budget), ([Variance])}
      )
ON COLUMNS
from Sample.Basic

returns the grid

Table 4-138 Output Grid from MDX Example

Old Fashioned Diet Root Beer Sarsaparilla Birch Beer Root Beer Cream Soda
Budget Variance Budget Variance Budget Variance Budget Variance Budget Variance Budget Variance
11640 -4439 14730 -2705 5050 -414 4530 -438 35950 -7996 29360 -3561