Returns: A set.
>>-Order--(--SetExpression----,--+-NumericExpression-+----+--------------+--)->< '-StringExpression--' '-,--+-ASC---+-' +-DESC--+ +-BASC--+ '-BDESC-'
| Flag | Order | Hierarchical behavior |
|---|---|---|
| ASC | Ascending | Preserves the hierarchy |
| DESC | Descending | Preserves the hierarchy |
| BASC | Ascending | Breaks the hierarchy |
| BDESC | Descending | Breaks the hierarchy |
If you specify that the hierarchy is to be preserved, members are sorted with their siblings, but keep their positions relative to their cousins; if instead you specify that the hierarchy is to be broken, members are sorted without regard to their hierarchical positions. For example, suppose you have a set of months, January, February, March, and April; January and March are children of the 2007 member, and February and April are children of the 2008 member. The hierarchy-preserving order of the months is January, March, February, April, whereas the hierarchy-breaking order is January, February, March, April.
The following example uses the function to retrieve the sales amount for ValueTrend Store 554 and all ascendants of this store in descending hierarchical order of sales amount.
SELECT {[Price Analysis].[Measures].[Sales Amount]} ON AXIS(0)
, {Order(Ascendants([Price Analysis].[Store].[All Stores].[Subdivision 1A]
.[Region 44].[District 38].[ValueTrend Store 554]),
[Price Analysis].[Measures].[Sales Amount], DESC)} ON AXIS(1)
FROM [Price Analysis]
| Store | Sales Amount |
|---|---|
| All Stores | 2719121.06 |
| Subdivision 1A | 1423778.49 |
| Region 44 | 872423.17 |
| District 38 | 413491.11 |
| ValueTrend Store 554 | 184520.49 |
The following example uses the function to retrieve the sales amount for stores in descending hierarchical order.
SELECT {[Price Analysis].[Measures].[Sales Amount]} ON AXIS(0)
, {Order(Descendants([Price Analysis].[Store].[All Stores], -1, LEAVES),
[Price Analysis].[Measures].[Sales Amount], DESC)} ON AXIS(1)
FROM [Price Analysis]
| Store | Sales Amount |
|---|---|
| ValueTrend Store 1414 | 267831.59 |
| ValueTrend Store 835 | 191100.47 |
| ValueTrend Store 782 | 228970.62 |
| ValueTrend Store 554 | 184520.49 |
| ValueTrend Store 1199 | 281038.93 |
| ValueTrend Store 1095 | 270316.39 |
| ValueTrend Store 681 | 260621.19 |
| ValueTrend Store 375 | 257877.78 |
| ValueTrend Store 875 | 256457.18 |
| ValueTrend Store 116 | 271528.06 |
| ValueTrend Store 278 | 248858.36 |
The following example uses the function to retrieve the sales amount for stores in descending nonhierarchical order.
SELECT {[Price Analysis].[Measures].[Sales Amount]} ON AXIS(0)
, {Order(Descendants([Price Analysis].[Store].[All Stores], -1, LEAVES),
[Price Analysis].[Measures].[Sales Amount], BDESC)} ON AXIS(1)
FROM [Price Analysis]
| Store | Sales Amount |
|---|---|
| ValueTrend Store 1199 | 281038.93 |
| ValueTrend Store 116 | 271528.06 |
| ValueTrend Store 1095 | 270316.39 |
| ValueTrend Store 1414 | 267831.59 |
| ValueTrend Store 681 | 260621.19 |
| ValueTrend Store 375 | 257877.78 |
| ValueTrend Store 875 | 256457.18 |
| ValueTrend Store 278 | 248858.36 |
| ValueTrend Store 782 | 228970.62 |
| ValueTrend Store 835 | 191100.47 |
| ValueTrend Store 554 | 184520.49 |