是否有一个mdx函数将一个set作为参数,一个成员函数作为一个单独的参数,并返回一个具有该函数的集合适用于成员?
我有一组选定的日期,并希望返回一个日期相同的集合少于1年,因此需要在每个成员上使用Parallelperiod。
答案 0 :(得分:2)
这种方法似乎没问题:
WITH
SET [fewDays] AS
[Date].[Calendar].[Date].&[20070121]
:
[Date].[Calendar].[Date].&[20070127]
SET [theDates] AS
Generate
(
[fewDays] AS s
,{ParallelPeriod
(
[Date].[Calendar].[Calendar Year]
,1
,s.CurrentMember
)}
)
SELECT
{} ON 0
,[theDates] ON 1
FROM [Adventure Works];
我认为这更漂亮,它避免了生成因此可能更快:
WITH
SET [fewDays] AS
[Date].[Calendar].[Date].&[20070121]
:
[Date].[Calendar].[Date].&[20070127]
MEMBER [Measures].[cntMembers] AS
[fewDays].Count
SET [LastMemLastYear] AS
{
ParallelPeriod
(
[Date].[Calendar].[Calendar Year]
,1
,Tail([fewDays]).Item(0)
)
}
SET [theDates] AS
[LastMemLastYear].Item(0).Lag(
[Measures].[cntMembers])
:
[LastMemLastYear].Item(0)
SELECT
{} ON 0
,[theDates] ON 1
FROM [Adventure Works];