Monday, February 20, 2012

MDX ORDER() QUESTION

Hello,

I'm trying to re-order my time hierarchy, from ascending to descending. When I use the following order statement, the years order descending, but the months remain ascending. How can I simply reverse the default order? Thanks.

(ORDER([Period Dim].[Calendar Hier].[Calendar Month].MEMBERS,[Period Dim].[Calendar Hier].CURRENTMEMBER.MEMBER_KEY,DESC)

results:

Calendar Year

Calendar Month

2006

"JANUARY 2006

2006

"FEBRUARY 2006

2005

"JANUARY 2005

2005

"FEBRUARY 2005

2005

"MARCH 2005

Try using MEMBER_VALUE instead of MEMBER_KEY. That seemed to work when I tried to reproduce using Adventure Works. See the query below.

HTH,

Dave Fackler

select

[Measures].[Internet Order Count] on columns,

Order([Date].[Calendar].[Month].Members, [Date].[Calendar].CurrentMember.Member_Value, bdesc) on rows

from

[Adventure Works]

|||

When I've reversed sets, I've found that method (MemberValue) to be VERY slow..
I just ran the query above and it was 33s.

This is 2s

select

[Measures].[Internet Order Count] on columns,

Order([Date].[Calendar].[Month].Members, [Date].[Calendar].CurrentMember.Properties ("ID", TYPED), bdesc) on rows

from

[Adventure Works]

No comments:

Post a Comment