Using the order of members existing in a database outline, returns a range of members inclusive of and between two members in the same generation or level.
Syntax
MemberRange ( member1, member2 [,layertype] [, hierarchy ] )
member1:member2
| Parameter | Description |
|---|---|
member1 | The beginning point of the member range. |
member2 | The endpoint of the member range. |
layertype | GENERATION or LEVEL. Available only with function-style MemberRange() syntax. If omitted or if operator-style member:member syntax is used, the range of members returned is inclusive of and between two specified members of the same generation. If MemberRange(member, member, LEVEL) is used, the range of members returned is inclusive of and between two specified members of the same level. |
hierarchy | Optional. A specific hierarchy within the time dimension. |
Notes
If the two input members are not from the same generation or level, the result is an empty set.
If the two input members are not from the same dimension, an error is returned.
The order of the output resembles the order of the input. See Example 2.
If the hierarchy argument is passed, member1 and member2 should belong to the same hierarchy. Otherwise, an empty set is returned.
When multiple hierarchies are enabled, this function returns NULL when the range begins in one hierarchy and terminates in another hierarchy.
Example
The following set:
{ [Year].[Qtr1], [Year].[Qtr2], [Year].[Qtr3], [Year].[Qtr4] }is returned by both of the following examples:
MemberRange ( [Year].[Qtr1], [Year].[Qtr4] ) ( [Year].[Qtr1] : [Year].[Qtr4] )
[Jan] : [Mar]
returns:
{ [Jan], [Feb], [Mar] }
[Mar] : [Jan]
returns:
{ [Mar], [Feb], [Jan] }
The following query
SELECT
{[Measures].[Sales], [Measures].[Profit]}
ON COLUMNS,
MemberRange([Year].[Feb], [Year].[Nov])
ON ROWS
FROM Sample.Basicreturns the grid:
| (axis) | Sales | Profit |
|---|---|---|
| Feb | 32069 | 8346 |
| Mar | 32213 | 8333 |
| Apr | 32917 | 8644 |
| May | 33674 | 8929 |
| Jun | 35088 | 9534 |
| Jul | 36134 | 9878 |
| Aug | 36008 | 9545 |
| Sep | 33073 | 8489 |
| Oct | 32828 | 8653 |
| Nov | 31971 | 8367 |
See Also