1

我在使用 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]

出于某种原因,它没有使用级别序数对表进行排序。

感谢!

4

1 回答 1

3

MDX 排序的默认设置不会破坏级别层次结构,即它保持首先是父级,然后是其子级的主要顺序。它仅将排序应用于同一父级的子级。如果要在排序中打破层次结构,请使用BASC("break sort assending") 代替默认设置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]
于 2013-08-22T18:23:03.460 回答