我尝试创建一个包含字段返回的OLAP选择器,也是一个包含其他字段总和的字段。如何修改此MDX查询以解决此问题:
WITH
MEMBER [Measures].[Name] AS
[Year].CurrentMember.UniqueName
SELECT
Filter
(
{Descendants([Year].[All Years],[Year].[Year])}
,(NOT
IsEmpty([Year].CurrentMember))
) ON ROWS
,{[Measures].[Name]} ON COLUMNS
FROM [*My Table*];
我希望我的选择器显示......" 2010" " 2011" " 2012" " 2013" " 2014"和" ALL"
答案 0 :(得分:0)
您应该能够将[All]成员添加到您在行上使用的集合中:
WITH
MEMBER [Measures].[Name] AS
[Year].CurrentMember.UniqueName
SELECT
{
[Year].[All Years]
,Filter
(
{Descendants([Year].[All Years],[Year].[Year])}
,(NOT
IsEmpty([Year].CurrentMember))
)
} ON ROWS
,{[Measures].[Name]} ON COLUMNS
FROM [*My Table*];
使用All成员的更通用名称并简化您获得年度成员的方式:
WITH
MEMBER [Measures].[Name] AS
[Year].CurrentMember.UniqueName
SELECT
{
[Year].[All]
,Filter
(
[Year].[Year].MEMBERS
,(NOT
IsEmpty([Year].CurrentMember))
)
} ON ROWS
,{[Measures].[Name]} ON COLUMNS
FROM [*My Table*];
答案 1 :(得分:0)
未明白您的要求。但是,如果您希望看到DESCENDANTS
函数输出产生的所有年份,您可以尝试在计算成员中使用GENERATE
函数。
WITH MEMBER Measures.[Years] AS
GENERATE
(
Filter
(
{Descendants([Year].[All Years],[Year].[Year])}
,(NOT
IsEmpty([Year].CurrentMember))
)
,
[Year].[Year].currentmember.member_value
,
" "
)