有关mdx查询的ORDER无法正常工作

时间:2013-08-22 08:35:13

标签: ssas mdx

我在订购带有MDX查询的列时遇到问题。

这是我的疑问:

with
     Member
     [Measures].[MemberUN] as '[Employee].[Employee Department].CurrentMember.UNIQUE_NAME'
     member
     [Measures].[Memberlevel] as '[Employee].[Employee Department].CurrentMember.LEVEL.ordinal'
Select
ORDER([Employee].[Employee Department].allmembers,[Measures].[Memberlevel]) on 1,
{[Measures].[MemberUN],[measures].[MemberLevel]} on 0
From [Adventure Works]

由于某种原因,它没有按顺序排序表。

感谢!

1 个答案:

答案 0 :(得分:3)

MDX排序的默认设置不会破坏级别层次结构,即。即它保持主要的顺序,首先是父母,然后是孩子。它仅将排序应用于同一父项的子项。如果要在排序中中断层次结构,请使用BASC(“打破升序排序”)而不是默认设置ASC,或使用BDESC代替DESC。以下查询按您可能的方式排序:

with
     Member
     [Measures].[MemberUN] as '[Employee].[Employee Department].CurrentMember.UNIQUE_NAME'
     member
     [Measures].[Memberlevel] as '[Employee].[Employee Department].CurrentMember.LEVEL.ordinal'
Select
ORDER([Employee].[Employee Department].allmembers, [Measures].[Memberlevel], BASC) on 1,
{[Measures].[MemberUN],[measures].[MemberLevel]} on 0
From [Adventure Works]