基于SSRS元组参数的MDX条件/动态案例语句

时间:2015-10-23 07:43:22

标签: reporting-services mdx ssrs-2012

是否可以在MDX查询中构建一个case语句(或等效语句),以根据SSRS的参数输入将维成员组合在一起?

下面是一个查询,大致显示了我想要实现的内容(参数已经被注释掉并且硬编码用于测试)我担心我对mdx很新;

WITH
--PERIOD FOR COMPARISON BLOCK
SET [MonthNumber] AS
(
STRTOSET("[Date Procurement Created].[Month Number].&[9]"
        --@DimCalendarMonthNumber
        , CONSTRAINED)
)
--CONDITIONAL CASE BLOCK
SET [SelectedSuppliers] AS

      CASE [Dim Supplier].[Supplier Name].CurrentMember
         WHEN STRTOSET("[Dim Supplier].[Supplier Name].&[Flannels Direct Co Ltd],[Dim Supplier].[Supplier Name].&[Zucchini Trading Co]"
        --@DimSupplierSupplierName
        , CONSTRAINED)

         THEN [Dim Supplier].[Supplier Name].CurrentMember

         ELSE 'Other'
      END

--CURRENT PERIOD BLOCK
MEMBER [Measures].[CP_LineTotal]
AS SUM(
([Measures].[Line Total],[MonthNumber])
),   FORMAT_STRING = 'Currency'

--MAIN QUERY BLOCK
SELECT {
[Measures].[Line Total]
, [Measures].[CP_LineTotal]

}
ON 0,

NON EMPTY (

[SelectedSuppliers]
*[Dim Supplier].[AC Number].[AC Number].MEMBERS
*[Date Procurement Created].[Year Name].[Year Name].MEMBERS

)
ON 1

FROM
[TRANSACTION_PROCUREMENT]

1 个答案:

答案 0 :(得分:0)

我认为您的代码的这一部分可能会更改为以下内容:

Bundle b = new Bundle();
            b.putString("TITLE", item.getTitle);
            b.putParcelable("BITMAP", item.getImage());

            intent.putExtras(b);
如果可能,应始终使用

SET [SelectedSuppliers] AS IIF( [Dim Supplier].[Supplier Name].CurrentMember IS [Dim Supplier].[Supplier Name].&[Flannels Direct Co Ltd],[Dim Supplier].[Supplier Name].&[Zucchini Trading Co] ,[Dim Supplier].[Supplier Name].CurrentMember ,'Other' ) 而不是IIF 使用CASE运算符来比较成员。

也不需要在度量定义中使用IS,因为一个简单的元组就足够了:

Sum