我想通过仅选择从 [ComptaPlanId].[ComptaDateDebut]
到 [ComptaPlanId].[ 的月份来过滤
,但自从
[ComptaEcriture Date]
的月份。 ComptaDateFin][ComptaDateDebut]
和 [ComptaDateFin]
与 [ComptaEcriture Date].[ComptaEcriture Date].[ 不是来自同一级别,机器人也不是来自同一维度。月]
,我不知道如何实现这一点。
如果我能生成一系列月份那就太好了。我的尺寸如下:
最佳答案
假设您正在测试 PlanId 不是 All 成员,则可以使用 isAll MDX+ 函数用于此。
对于该集合,我们将组合 Filter function与 Declared function ,即使我们可以将所有代码放入过滤器中。它看起来像:
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 或子选择)
关于iccube - 使用多级层次结构生成月份范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47452875/