MDX单元格计算 - 如何在SSRS中参数化其表达式

时间:2017-04-21 06:52:54

标签: reporting-services mdx

我在查询中有一个单元格计算,我用于SSRS查询并包含参数,如;

MEMBER Measures.[SatisTotalYTD] AS null
CELL CALCULATION ScopeEmulator
FOR '(order(STRTOSET(@Ay1),[DimDateView].[YearMonthNumber].currentMember.name,BDESC).item(0),Measures.[SatisTotalYTD])'
AS [Measures].[KapananAyaKadarTotalYTD]

但是当我执行查询时,它给出了错误

  

无法解析参数,因为它是在内部子表达式中引用的

所以我尝试将参数值定义为一组;

with
SET [Aylar1] as STRTOSET(@Ay1)
MEMBER Measures.[SatisTotalYTD] AS null
CELL CALCULATION ScopeEmulator
FOR '(order([Aylar1],[DimDateView].[YearMonthNumber].currentMember.name,BDESC).item(0),Measures.[SatisTotalYTD])'
AS [Measures].[KapananAyaKadarTotalYTD]

然后它给了我

  

Aylar1集的定义包含循环引用。

那么如何在单元格计算表达式中使用参数?

1 个答案:

答案 0 :(得分:0)

你误解了范围概念。你不能做任何计算,你只能改变那里的元组行为。我不确定你使用ScopeEmulator的动机是什么。考虑到上面的代码,暂停查询必须做出魔术:

With

Set LastTuple as
Tail(StrToSet(@Ay1))

Member [Measures].[SatisTotalYTD] as
IIF(
    [DimDateView].[YearMonthNumber].CurrentMember is LastTuple,
    [Measures].[KapananAyaKadarTotalYTD],
    Null
)