层次结构导航
1 访问层次结构中的其它成员
1.1 Parent:父成员
1.2 Children:所有子成员
1.3 firstChild:第一个子成员
1.4 lastChild:最后一个子成员
1.5 siblings:所有兄弟成员
1.6 firstSibling:第一个兄弟成员
1.7 lastSibling:最后一个兄弟成员
以上返回的都是成员的引用,一般在计算成员中使用,如下
with
member [parent] as[Date].[Year Num].currentMember.parent.name
member [firstChild]as [Date].[Year Num].currentMember.firstChild.name
member[lastSibling] as [Date].[Year Num].currentMember.lastSibling.name
select
{
[parent],
[firstChild],
[lastSibling]
}on 0,
{
[Date].[Year Num].members
}on 1
from
[Park]
2 rank(tuple, set [,expression])
生成元组在集合中的排名
with
member [rank] as
rank(
[Date].[YearNum].currentMember,
[Date].[Year Num].members,
[Measures].[In Count]
)
select
{
[Measures].[In Count],
[rank]
}on 0,
{
[Date].[Year Num].members
}on 1
from
[Park]
以上计算成员生成了对[Date].[YearNum]层次结构下的所有成员的按[Measures].[In Count]度量值进行排序的排名,如果度量值一样则排名一样
如果需要对排名进行排序,如下:
with
member [rank] as
rank(
[Date].[YearNum].currentMember,
[Date].[Year Num].members,
[Measures].[In Count]
)
select
{
[Measures].[In Count],
[rank]
}on 0,
order(
[Date].[Year Num].members,
[rank],
asc
)on 1
from
[Park]