假设您正在测试 PlanId 不是 All 成员,您可以为此使用isAll MDX+ 函数。
对于这个集合,我们将Filter 函数与一个Declared 函数结合起来,即使我们可以将它的所有代码都放在过滤器中。它看起来像:
WITH
FUNCTION inRange(Value _date,Value _start, Value _end) AS _start <= _date AND _date <= _end
SET myDates as Filter( [Date].[Date].[Month] as t, inRange(t.current.key, DateTime(2015,6,1), DateTime(2017,1,1) ) )
SELECT
myDates on 0
FROM [Cube]
并使用紧凑和更快的版本:
SELECT
Filter( [Date].[Date].[Month] as t, DateTime(2015,6,1) <= t.current.key AND t.current.key <= DateTime(2017,1,1) ) on 0
FROM [Cube]
使用成员:
WITH
FUNCTION inRange(Value _date,Value _start, Value _end) AS _start <= _date AND _date <= _end
SET myDates as Filter( [Date].[Date].[Month] as t,
inRange(t.current.key, [ComptaDateDebut].currentmember.key, [ComptaDateFin].currentmember.key )
)
SELECT
myDates on 0
FROM [Cube]
您可以使用contextMember而不是 currentMember 来检查切片器(FILTER BY 或子选择)