Union

Returns the union of two input sets, optionally retaining duplicates.

Syntax

Union ( set1, set2 [,ALL] )

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.

Description

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.

Examples

Example 1

The expression

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

returns the set

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

Example 3

The expression

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

returns the set

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

Example 2

The following query

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

returns the grid

Old Fashioned Diet Root Beer Sasparilla 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

©2004 Hyperion Solutions Corporation. All Rights Reserved.
http://www.hyperion.com