我有以下MDX查询:
SELECT
NON EMPTY
Measures.[Enrolments] ON COLUMNS,
NON EMPTY
( STRTOMEMBER(@FromISOYear, CONSTRAINED) :
STRTOMEMBER(@ToISOYear, CONSTRAINED) ) ON ROWS
FROM (
SELECT
Filter
(
[Term Start Date].[ISO Year].Children *
[Term Record Creation].[ISO Year].Children *
[Term Record Creation].[ISO Week Number Of Year].Children
,
Cint([Term Record Creation].[ISO Week Number Of Year].CurrentMember.Member_Key) <= Cint( STRTOMEMBER(@ToISOWeekNumberOfYear, CONSTRAINED) )
OR
Cint([Term Record Creation].[ISO Year].CurrentMember.Member_key) < Cint([Term Start Date].[ISO Year].CurrentMember.Member_key)
) ON COLUMNS
FROM [Enrolments]
);
基本上,当ISO Week Number of Year
不是参数时,过滤器表达式有效。如果我将过滤器表达式更改为[ISO Week Number of Year] <= 7
,则会提供正确的结果。当我从SSRS传递相同的值作为参数时,我得到的结果不正确 - 过滤器似乎没有被应用。
有人可以解释一下这是为什么并提供修复吗?
答案 0 :(得分:1)
我注意到你在这里缺少Member_Key。更改以下内容:
Cint( STRTOMEMBER(@ToISOWeekNumberOfYear, CONSTRAINED) )
要:
Cint( STRTOMEMBER(@ToISOWeekNumberOfYear, CONSTRAINED).Member_Key )