Union
Returns the union of two sets, optionally retaining duplicates.
Syntax
Union(Set1_Expression, Set2_Expression [, ALL|DISTINCT])
Arguments
Set_Expression | MDX expression that returns set. |
---|---|
ALL | Optional parameter. If ALL is specified, the function retains duplicates in the resulting set. |
DISTINCT | Optional parameter. If DISTINCT is specified, the function removes duplicates in the resulting set. Also a default parameter, if none is provided for the function |
Examples
Both examples below use a calculated member "Bugs & stories" from the "Issue type" dimension. It aggregates two issue types together for calculations.
Aggregate({ [Issue Type].[Bug], [Issue Type].[Story] })
Following ar the examples of calculated measures using the Union function to calculate the sum of issues created.
The first example of Union would sum the issues created for distinct set members from Issue type dimension. Tickets with the Bug type would be counted just once in the results.
Sum( Union( CascadingChildrenSet([Issue Type].[Bugs & stories]), [Issue Type].[Bug] ), [Measures].[Issues created] )
The next example of Union would return the sum of issues created for two members from Issue type dimension. Tickets with Bug type would be counted twice in results.
Sum( Union( CascadingChildrenSet([Issue Type].[Bugs & stories]), [Issue Type].[Bug], ALL ), [Measures].[Issues created] )
See also
- Function Distinct
- Function CascadingChildrenSet
- Function ChildrenSet
- Function Aggregate