SUBSET (MDX)
Returns a set of elements from a given set, by position. The first member is at position 0.
Returned Type
This function returns a set.
Syntax and Details
SUBSET(set_expression, first_element_position, optional_element_count)
Where:
-
set_expression is an expression that evaluates to a set.
-
first_element_position is an integer literal that specifies the position of the first element to return.
The position of the first element is 0.
-
optional_element_count is an integer literal that specifies the position of the number of element to return.
If you omit this argument, the function returns the element at first_element_position and all elements that follow it.
Example
SELECT MEASURES.[%COUNT] ON 0, SUBSET(homed.city.MEMBERS, 0, 3) ON 1 FROM patients
Patient Count
1 Cedar Falls 1,188
2 Centerville 1,155
3 Cypress 1,221
In contrast, consider this example, which shows the complete set:
SELECT MEASURES.[%COUNT] ON 0, homed.city.MEMBERS ON 1 FROM patients
Patient Count
1 Cedar Falls 1,188
2 Centerville 1,155
3 Cypress 1,221
4 Elm Heights 1,266
5 Juniper 1,197
6 Magnolia 1,156
7 Pine 1,139
8 Redwood 1,144
9 Spruce 1,135