Order by in MDX

  • Hi i need to put an order by in my MDX query does any know the syantx for this in MDX ?

    thanks

  • You will need to create a custom set and then rank that set.

    http://msdn.microsoft.com/en-us/library/ms144726.aspx

    Sample:

    WITH

    SET MySet AS

    Extract

    (

    NonEmpty

    (

    Axis(1)

    ,{[Measures].[Iteration Count]}

    )

    ,[User].[BK User ID]

    )

    MEMBER [Measures].[User Count] AS

    Rank

    (

    [User].[BK User ID].CurrentMember

    ,MySet

    )

    ,NON_EMPTY_BEHAVIOR =

    {[Measures].[Iteration Count]}

    SET [Ordered_Avg_By_Login] AS

    Order

    (

    [User].[Login Name].Children

    ,[Measures].[Avg_CurrentUnderstanding]

    ,BDESC

    )

    gsc_dba

  • gsc_dba (7/2/2010)


    You will need to create a custom set and then rank that set.

    http://msdn.microsoft.com/en-us/library/ms144726.aspx

    Sample:

    WITH

    SET MySet AS

    Extract

    (

    NonEmpty

    (

    Axis(1)

    ,{[Measures].[Iteration Count]}

    )

    ,[User].[BK User ID]

    )

    MEMBER [Measures].[User Count] AS

    Rank

    (

    [User].[BK User ID].CurrentMember

    ,MySet

    )

    ,NON_EMPTY_BEHAVIOR =

    {[Measures].[Iteration Count]}

    SET [Ordered_Avg_By_Login] AS

    Order

    (

    [User].[Login Name].Children

    ,[Measures].[Avg_CurrentUnderstanding]

    ,BDESC

    )

    You will then have to refer to your set in your MDX:

    SELECT

    NON EMPTY

    {

    [Measures].[Your Measure Goes Here]

    } ON COLUMNS

    ,NON EMPTY

    {

    [Ordered_Avg_By_Login]*

    gsc_dba

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply