我有以下MDX查询:
with
MEMBER [Measures].[Prior Week]
AS AGGREGATE(ParallelPeriod([Date].[Sun Weeks], 1, [Date].[Sun Weeks].CURRENTMEMBER), [Measures].[Value Count])
SELECT
NON EMPTY
{
[Measures].[Value Count],
[Measures].[Prior Week]
} ON COLUMNS,
NON EMPTY
{
( [Date].[Sun Weeks].[Day].ALLMEMBERS )
} ON ROWS
FROM [MyCube];
太阳周等级是[日期]。[太阳周]。[太阳周年]。[太阳周]。[日]
当我运行上述查询时,[上周]列会生成#Error
有谁知道为什么?我如何解决它?它与ParallelPeriod有关吗?
答案 0 :(得分:0)
您可能需要显式强制第一个参数为集合:
MEMBER [Measures].[Prior Week] AS
AGGREGATE(
{ParallelPeriod(
[Date].[Sun Weeks]
, 1
, [Date].[Sun Weeks].CURRENTMEMBER
)}
,[Measures].[Value Count]
)
但是你给ParallelPeriod的第一个参数是[Date].[Sun Weeks]
...这是你立方体中的一个级别吗?该函数需要一个级别作为其第一个参数。
如果您想要实现的目标是回溯7天,那么滞后就更容易了:
MEMBER [Measures].[Prior Week] AS
(
[Date].[Sun Weeks].CURRENTMEMBER.lag(7).item(0)
,[Measures].[Value Count]
)
或者你可以延迟7天,然后跳到一周的水平:
MEMBER [Measures].[Prior Week] AS
(
[Date].[Sun Weeks].CURRENTMEMBER.lag(7).parent
,[Measures].[Value Count]
)