Search code examples
ssasmdxmdx-query

ORDER ALLMEMBERS BY ASC [MDX]


Using my query I can get by Month in a specific year my sales but I have disorder. Columns are ordered by:

1,10,11,12,2,3,4,5,6...

it should be: 1,2,3,4,5,5,6,...10,11,12

How can I change that?

Here's my code

SELECT 
   [Dim Tiempo].[Mes].[Mes].AllMembers 
ON COLUMNS,  
   NONEMPTY (ORDER(
        { [Dim Cliente].[Company Name].CHILDREN},

            [Dim Cliente].[Company Name].CURRENTMEMBER.MEMBER_NAME, ASC

    ))

ON ROWS  

FROM [DWH Northwind]

WHERE [Dim Tiempo].[Año].&[1997]

DX


Solution

  • The problem is with your dimension not with your query. You need to check the ordering of your months. I presume they are ordered on their text value. To check just drop them in cube browser and observe. If that be the case you need to fix the id column of your months table. Plus in the project go to your month dimension, for the month name the id should be the key column and in Orderby set the value key(all this will be done in properties window