mdx 层次结构 return 查询中的父项和子项
mdx hierarchy return parent and child in query
我有以下查询
WITH
MEMBER [Measures].[Period Key] AS
Axis(1).Item(1).Item(1).Hierarchy.CurrentMember.UniqueName
MEMBER [Measures].[Year Key] AS
[Dim Date].[Year].CurrentMember.UniqueName
SELECT
{
[Measures].[Valuation]
,[Measures].[Period Key]
,[Measures].[Year Key]
} ON 0
,(
[Dim Date].[Hierarchy].[Quarter].ALLMEMBERS
,[Dim Platform].[Platform Key].ALLMEMBERS
) ON 1
FROM [Cube];
我希望 Year Key 改为 return 层次结构中的唯一名称,因为我想在参数中使用它。在这种形式中,它将导致错误,因为字段定义期望层次结构形式的结果。
这可能吗?
不是 100% 确定要求,但如果我 运行 以下内容反对 AdvWrks
:
WITH
MEMBER [Measures].[Period Key] AS
Axis(1).Item(1).Item(1).Hierarchy.CurrentMember.UniqueName
MEMBER [Measures].[Year Key] AS
[Date].[Calendar Year].CurrentMember.UniqueName
MEMBER [Measures].[New Key] AS
[Date].[Calendar Quarter].CurrentMember.UniqueName
SELECT
NON EMPTY
{
[Measures].[Internet Sales Amount]
,[Measures].[Period Key]
,[Measures].[Year Key]
,[Measures].[New Key]
} ON 0
,NON EMPTY
(
[Date].[Calendar].[Calendar Quarter].ALLMEMBERS
,[Product].[Product Categories].ALLMEMBERS
) ON 1
FROM [Adventure Works];
结果是:
[New Key]
是否与您在多维数据集中所需的相似?
假设您的层次结构是年-学期-季-月-日,使用
怎么样?
[Dim Date].[Hierarchy].CurrentMember.Parent.Parent.UniqueName
如果您有年-季-月-日,
[Dim Date].[Hierarchy].CurrentMember.Parent.UniqueName
它正在做的是查看当前季度并通过使用 .PARENT
函数在层次结构树中向上返回相应的年份。
我有以下查询
WITH
MEMBER [Measures].[Period Key] AS
Axis(1).Item(1).Item(1).Hierarchy.CurrentMember.UniqueName
MEMBER [Measures].[Year Key] AS
[Dim Date].[Year].CurrentMember.UniqueName
SELECT
{
[Measures].[Valuation]
,[Measures].[Period Key]
,[Measures].[Year Key]
} ON 0
,(
[Dim Date].[Hierarchy].[Quarter].ALLMEMBERS
,[Dim Platform].[Platform Key].ALLMEMBERS
) ON 1
FROM [Cube];
我希望 Year Key 改为 return 层次结构中的唯一名称,因为我想在参数中使用它。在这种形式中,它将导致错误,因为字段定义期望层次结构形式的结果。 这可能吗?
不是 100% 确定要求,但如果我 运行 以下内容反对 AdvWrks
:
WITH
MEMBER [Measures].[Period Key] AS
Axis(1).Item(1).Item(1).Hierarchy.CurrentMember.UniqueName
MEMBER [Measures].[Year Key] AS
[Date].[Calendar Year].CurrentMember.UniqueName
MEMBER [Measures].[New Key] AS
[Date].[Calendar Quarter].CurrentMember.UniqueName
SELECT
NON EMPTY
{
[Measures].[Internet Sales Amount]
,[Measures].[Period Key]
,[Measures].[Year Key]
,[Measures].[New Key]
} ON 0
,NON EMPTY
(
[Date].[Calendar].[Calendar Quarter].ALLMEMBERS
,[Product].[Product Categories].ALLMEMBERS
) ON 1
FROM [Adventure Works];
结果是:
[New Key]
是否与您在多维数据集中所需的相似?
假设您的层次结构是年-学期-季-月-日,使用
怎么样?[Dim Date].[Hierarchy].CurrentMember.Parent.Parent.UniqueName
如果您有年-季-月-日,
[Dim Date].[Hierarchy].CurrentMember.Parent.UniqueName
它正在做的是查看当前季度并通过使用 .PARENT
函数在层次结构树中向上返回相应的年份。