MDX Query getParentChild members at each level -
09-20-2005
, 04:44 AM
I want to retrieve the parent-child string at each level for a
dimension.
Now i have the following query using foodmart,budget cube
WITH
MEMBER [MEASURES].[MEMBNAME] as '
Space([Time].CurrentMember.level.ordinal*5) +
[Time].CurrentMember.Name'
MEMBER [MEASURES].[LEVEL] as '[Time].CurrentMember.level.ordinal'
MEMBER [MEASURES].[LEVELNAME] as '[Time].CurrentMember.level.name'
MEMBER [MEASURES].[ALLEVELNAME] as '[Time].CurrentMember.lead(2)'
Select
{
[MEASURES].[MEMBNAME]
,[MEASURES].[LEVEL]
,[MEASURES].[LEVELNAME]
}
on columns,
{[Time].members} on rows
from budget
This query gives the members for this dimension at each level.
Basically hierachial.
Query results is below,
MEMBER NAME LEVEL NAME LEVEL
1997 Year 0
Q1 Quarter 1
1 Month 2
2 Month 2
3 Month 2
Q2 Quarter 1
4 Month 2
5 Month 2
6 Month 2
Q3 Quarter 1
7 Month 2
8 Month 2
9 Month 2
Q4 Quarter 1
10 Month 2
11 Month 2
12 Month 2
1998 Year 0
Q1 Quarter 1
1 Month 2
2 Month 2
3 Month 2
Q2 Quarter 1
4 Month 2
5 Month 2
6 Month 2
Q3 Quarter 1
7 Month 2
8 Month 2
9 Month 2
Q4 Quarter 1
10 Month 2
11 Month 2
12 Month 2
Now i need to add another column which returns a entire parent
hierarchy at each level.
Ex; at
1 Month 2 row i need a string ='1997*q1*1'
2 Month 2 row i need a string ='1997*q2*2' |