order

Arranges the members of "set_expression" according to their "value_expression" and the third parameter. ASC and DESC arrange members in ascending or descending order, respectively, according to their position in the set hierarchy. Then the children of each member are arranged according to "value_expression". BASC and BDESC arrange members in the set without regard to the hierarchy. In the absence of an explicit specification, ASC is the default.

Syntax

order ( set_expression , value_expression [ , ASC|DESC|BASC|BDESC ] )

Example 1

order ( members ( [Great Outdoors Company].[Product].[Product].
[Product type] ) , [Quantity sold] , BASC )

Result

Returns the quantity sold for each product type in no particular order.

Result data

ProdLine Quantity
Woods 13,924
Irons 14,244
Safety 22,332
... ...
Sun 215,432
Repellent 270,04
Lanterns 345,096

Example 2

order ( members ( [Great Outdoors Company].[Product].[Product].
[Product type] ) , [Quantity sold] , ASC )

Result

Returns the quantity sold for each product type in ascending order.

Result data

ProdLine Quantity
Woods 13,924
Irons 14,244
Putters 23,244
... ...
Tents 130,664
Cooking 198,676
Lanterns 345,096