MDX - 按维度过滤度量

时间:2014-07-17 07:44:50

标签: mdx

我是MDX新手,我目前正在尝试过滤[Measures].[Sales Invoice Line Amount] { [NAV CINNOST].[DIM_Code_Cinnost].&[AAA], [NAV CINNOST].[DIM_Code_Cinnost].&[BBB], [NAV CINNOST].[DIM_Code_Cinnost].&[CCC] }

我只需要过滤此度量(销售发票行金额)。不是其他人。你能指导我如何重写查询吗?

     SELECT
      NON EMPTY [Customer].[Customer No].[Customer No] DIMENSION PROPERTIES
      member_name, parent_unique_name ON ROWS,
      {
        [Measures].[Value Entry Item Ledger Entry Quantity],
        [Measures].[Unit Margin],
        [Measures].[Sales Invoice Line Amount]
      } ON COLUMNS
    FROM [QTY Margin]
    WHERE (
            {
              [Date].[Calendar Month].&[201407]
            },
            {
              [NAV CINNOST].[DIM_Code_Cinnost].&[AAA],
              [NAV CINNOST].[DIM_Code_Cinnost].&[BBB],
              [NAV CINNOST].[DIM_Code_Cinnost].&[CCC]
            }
          ) CELL PROPERTIES value, formatted_value, fore_color, back_color 

1 个答案:

答案 0 :(得分:1)

最快的解决方案是使用calculated member来完成您正在寻找的工作。假设你添加了这个维度:

WITH
  MEMBER [My Sales Invoice Line Amount] AS Sum( {[NAV CINNOST].[DIM_Code_Cinnost].&[AAA],[NAV CINNOST].[DIM_Code_Cinnost].&[BBB], [NAV CINNOST].[DIM_Code_Cinnost].&[CCC]},
                                           [Measures].[Sales Invoice Line Amount]) 
SELECT
  NON EMPTY [Customer].[Customer No].[Customer No] ON ROWS,
  {[Measures].[Value Entry Item Ledger Entry Quantity],
    [Measures].[Unit Margin],
    [Measures].[My Sales Invoice Line Amount]
  } ON COLUMNS
FROM 
    [QTY Margin]
WHERE 
    [Date].[Calendar Month].&[201407]