Skip to main content
Skip table of contents

Order

Arranges members of a set, optionally preserving or breaking the hierarchy.

Syntax

CODE
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.

CODE
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')
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.