我遇到了mdx脚本的问题,我正在尝试使用SUM函数聚合两个集合
基本上,我有两个计算成员会给我一个日期范围窗口
mdx脚本中的成员如下:
CREATE MEMBER CURRENTCUBE.[Measures].[NumberOfWeeksInPeriodLY] AS
COUNT(DESCENDANTS([Date].[Retail Calendar].CurrentMember.Lag(2),3),INCLUDEEMPTY)-1;
// This one will give me 15
CREATE MEMBER CURRENTCUBE.[Measures].[StartingWeekLY] AS
(DESCENDANTS([Date].[Retail Calendar].CurrentMember.Lag(2),3)).Item(0).Member_Key;
//This one will give me 130;
CREATE MEMBER CURRENTCUBE.[Measures].[EndingWeekLY] AS
Cint([Measures].[StartingWeekLY]+[Measures].[NumberOfWeeksInPeriodLY]); //This will give me 145
我试图做的是:
在我的MDX脚本中:
SCOPE([Date].[Retail Calendar].[Retail Semester].MEMBERS);
[Date Analysis - Retail Calendar].[Test53Weeks] =
SUM(
{
(
DESCENDANTS
(
[Date].[Retail Calendar].CurrentMember,3
)
.Item(1).Lag(53)
)
:
[Date].[Retail Calendar].[Retail Week].**Item([Measures].[EndingWeekLY]))**
}
,[Date Analysis - Retail Calendar].[Current Time Period]
);
END SCOPE;
如果我硬编码[日期]。[零售日历]。[零售周]。项目(145) 它工作,我得到了正确的聚合,
如果我使用[Date].[Retail Calendar].[Retail Week].Item([Measures].[EndingWeekLY]))
它不起作用,即使计算成员([Measures].[EndingWeekLY])
确实包含了145的价值,我把整个级别搞得一团糟......
到目前为止,我已经尝试过StrToMember,strToTuple,StrToSet函数,我也尝试过显式转换为int(CInt(([Measures]。[EndingWeekLY]))同样的结果......
任何关于hek错误的想法?
谢谢
瑞克