UnionSort

Joins Set1 and Set2 and sorts them based on the BaseSet's tuple order.

Syntax

UnionSort(Set1, Set2, BaseSet [, ALL])

BaseSet can be a crossjoin set or a normal set. The tuple order in this set is used to sort Set1 and Set2's tuples.

Specify the ALL flag to retain duplicate members. If this flag is not specified, the result does not contain duplicate members.

Set1 and Set2 must derive from a BaseSet. If one of set's tuples is not found in the base set, an error occurs.

Example

WITH 
   SET [BaseSet] as '[Products].members'
   SET [Set1] as 'Filter([BaseSet], [Products].CurrentMember.Properties("ATT1_PRODMAN") = "T Heinzel")'
   SET [Set2] as 'Filter([BaseSet], [Products].CurrentMember.Properties("ATT1_PRODMAN") = "J Junek")'
   SET [UnionSet] as 'UnionSort([Set1], [Set2], [BaseSet])'
SELECT [UnionSet] ON ROWS, [Measures].members ON COLUMNS
FROM totsales

Differences between Union(Set1, Set2, SORT)

Union(Set1, Set2, SORT) requires Set1 and Set2 to contain the tuple position and the Union function sorts them based on the already defined tuple position. The tuple position can only be generated in optimized Filter functions. Set1 and Set2 must be optimized Filter results. With UnionSort(Set1, Set2, BaseSet), Set1 and Set2 does not require the tuple position as the tuple position is determined while searching the tuple in base set.