Order
Arranges members of a set, optionally preserving or breaking the hierarchy.
Syntax
Order(Set_Expression, Value) Order(Set_Expression, Value, Symbol)
Arguments
Set_Expression | MDX expression that returns set. |
---|---|
Value | Value by which this set should be ordered |
Symbol | ASC, DESC - orders ascending or descending within members hierarchy BASC, BDESC -Â orders ascending or descending overriding members hierarchy |
Examples
The following example would get all the invoices for the selected customer, would sort them by Invoice date, return the last invoice and show it's date.
Order( Filter( NonEmptyCrossJoin( [Invoice].[Invoice].members, [Customer].CurrentMember ), NOT IsEmpty([Measures].[Invoice base amount]) ), [Invoice].CurrentMember.get('Invoice date'), DESC ).Item(0).Item(0).get('Invoice date')