MDX-фильтрация для мер - PullRequest
0 голосов
/ 25 мая 2018

Пожалуйста, помогите, необходимо отфильтровать:

[Меры]. [Сумма продаж] + [Меры]. [Непогашенные заказы] + [Меры]. [ПродажиСумма] <> 0

Ниже приведен мой запрос:

SELECT
  NON EMPTY { [Measures].[Ending Quantity],
  [Measures].[Average Unit Cost],
  [Measures].[Cost Amount],
  [Measures].[Sales Amount],
  [Measures].[Invoiced Quantity],
  [Measures].[Outstanding Orders],
  [Measures].[Average Unit Price] } ON COLUMNS,
  NON EMPTY { (
    [Item].[Item].[Item].ALLMEMBERS * [Item].[Last GRN Date].[Last GRN Date].ALLMEMBERS * [Item].[Division].[Division].ALLMEMBERS * [Item].[Last Order Number].[Last Order Number].ALLMEMBERS * [Item].[Vendor Item Number].[Vendor Item Number].ALLMEMBERS * [Item].[Unit Cost].[Unit Cost].ALLMEMBERS * [Item].[Current Retail Price].[Current Retail Price].ALLMEMBERS * [Item].[Vendor Name].[Vendor Name].ALLMEMBERS * [Item].[Last In Date].[Last In Date].ALLMEMBERS * [Item].[Last Markdown Date].[Last Markdown Date].ALLMEMBERS * [Item].[Last Markdown Code].[Last Markdown Code].ALLMEMBERS * [Item].[Buyer].[Buyer].ALLMEMBERS * [Item].[Inventoriable].[Inventoriable].ALLMEMBERS * [Item].[Original Retail Price].[Original Retail Price].ALLMEMBERS
  ) } DIMENSION PROPERTIES MEMBER_CAPTION,
  MEMBER_VALUE,
  MEMBER_UNIQUE_NAME ON ROWS
FROM
  (
    SELECT
      (
        { [Item].[Division].& [1000],
        [Item].[Division].& [2000],
        [Item].[Division].& [3000],
        [Item].[Division].& [4000],
        [Item].[Division].& [5000],
        [Item].[Division].& [6000],
        [Item].[Division].& [7000],
        [Item].[Division].& [8000],
        [Item].[Division].& [9000] }
      ) ON COLUMNS
    FROM
      (
        SELECT
          (
            { [Item].[Buyer].& [SHARAN],
            [Item].[Buyer].& [ALISHA],
            [Item].[Buyer].& [NORMAN],
            [Item].[Buyer].& [MARISA] }
          ) ON COLUMNS
        FROM
          (
            SELECT
              ({ [Item].[Inventoriable].& [Inventoriable] }) ON COLUMNS
            FROM
              [Sales Purchases and Stock]
          )
      )
  ) CELL PROPERTIES VALUE,
  BACK_COLOR,
  FORE_COLOR,
  FORMATTED_VALUE,
  FORMAT_STRING,
  FONT_NAME,
  FONT_SIZE,
  FONT_FLAGS;

1 Ответ

0 голосов
/ 25 мая 2018

Вы должны добавить предложение where с фильтром.Что-то вроде:

WHERE
   (
    FILTER 
      (
        [Measures].[Sales Amount] + [Measures].[Outstanding Orders] + [Measures].[Sales Amount] <> 0
      )
   );

Или вы можете добавить фильтр к размерам, например:

SELECT measure1,measure2 ON ROWS
FILTER(
dimension1 * dimension2 * dimension3 

,[Measures].[Sales Amount] + [Measures].[Outstanding Orders] + [Measures].[Sales Amount] <> 0)

ON COLUMNS

, или используя предложение HAVING, которое используется как:

SELECT dimension on 0, HAVING measure<>0 on 1 from ...
...