How does the MDX Order function orders ties

Answered How does the MDX Order function orders ties

  • Thursday, July 13, 2006 3:20 PM
     
     
    Hello all,

    When multiple tuples return the same value, is there an implementation independant way to know in which order the Order function will return those tuples?

    Essentially, I want to know if the MDX specification defines what it will return or if it doesn't say anything on the subject; i.e. the order is undefined in this case.

    To me it is important that the behavior is part of the specification because I dont want to rely on something that may change in the future; all I need is the documented behavior.  If the bahavior is "the order is undefined" I'm OK with that.

    Thanks.

     

    Michel Dion

All Replies

  • Friday, July 14, 2006 3:29 AM
    Moderator
     
     Answered

    I don't know what the MDX specification says, but AS 2000 Books Online does document Order() as doing a stable sort - ie. the relative input order is maintained for elements with identical values:

    >>

    Note  When the input set has two elements for which the «String Expression» or «Numeric Expression» has the same value, the input order is preserved.

    For example, if the sales for USA and Europe is 300 each, and the sales for Asia is 100, the following expression returns the set {Asia, USA, Europe}, not the set {Asia, Europe, USA}:

    Order({USA, Europe, Asia}, Sales, BASC)
    >>