开发者

MDX - Using "iif" function in the "Where" section

开发者 https://www.devze.com 2022-12-23 06:05 出处:网络
Hi I\'d like to know how to make that \"iif\" work. Basically, I need to filter the engineering \"product codes\" when originator is \"John Smith\". currentmember is not working or that iif is not wo

Hi I'd like to know how to make that "iif" work.

Basically, I need to filter the engineering "product codes" when originator is "John Smith". currentmember is not working or that iif is not working,

    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
    )
  );

Any ideas?

Thank开发者_C百科s in advance.

Duy


The best way to compare members in MDX is to use 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
    )
  );

Of course, you would have to change [Originators].[Originator One Letter Name].[JOHN SMITH] for the proper unique name of the member

0

精彩评论

暂无评论...
验证码 换一张
取 消