【问题标题】:MDX - Using "iif" function in the "Where" sectionMDX - 在“Where”部分使用“iif”函数
【发布时间】:2010-03-16 15:21:26
【问题描述】:

您好,我想知道如何使“iif”工作。

基本上,当发起人是“John Smith”时,我需要过滤工程“产品代码”。 currentmember 不工作或 iif 不工作,

    SELECT 
  {
    (
      [Time].[Fiscal Hierarchy Time Calculations].[Month to Date],
      [Measures].[Sell - Bookings]
    )
  } ON COLUMNS,
  [Originators].[Originator One Letter Name].Children ON ROWS
FROM [Sales]
WHERE 
  (
    [Time].[Fiscal Month].&[2010-02-01T00:00:00],
    IIF
    (
        [Originators].[Originator One Letter Name].CurrentMember = "John Smith",
      Except
      (
        [Product Codes].[Product Primary Subcategory].Children,
        [Product Codes].[Product Primary Subcategory].&[ENGINEERING]
      ),
      [Product Codes].[Product Primary Subcategory].Children
    )
  );

有什么想法吗?

提前致谢。

正当

【问题讨论】:

    标签: mdx where iif except


    【解决方案1】:

    在 MDX 中比较成员的最佳方法是使用IS

    SELECT 
      {
        (
          [Time].[Fiscal Hierarchy Time Calculations].[Month to Date],
          [Measures].[Sell - Bookings]
        )
      } ON COLUMNS,
      [Originators].[Originator One Letter Name].Children ON ROWS
    FROM [Sales]
    WHERE 
      (
        [Time].[Fiscal Month].&[2010-02-01T00:00:00],
        IIF
        (
            [Originators].[Originator One Letter Name].CurrentMember IS
                [Originators].[Originator One Letter Name].[JOHN SMITH],
          Except
          (
            [Product Codes].[Product Primary Subcategory].Children,
            [Product Codes].[Product Primary Subcategory].&[ENGINEERING]
          ),
          [Product Codes].[Product Primary Subcategory].Children
        )
      );
    

    当然,您必须更改 [Originators].[Originator One Letter Name].[JOHN SMITH] 以获得正确的成员名称

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多