mdx选择带有交叉连接的前n个

时间:2015-01-20 15:38:27

标签: filter mdx

我想过滤此查询并删除[Measures]。[Orders Count] = 1。

的成员

查询是由Excel数据透视表生成的 - 所有交叉连接和其他语法让我有些困惑:

WITH MEMBER [Measures].[Ticket Avg] as
 [Measures].[Net Amount] / [Measures].[Orders Count]
SELECT NON EMPTY CrossJoin (
 Hierarchize (
  DrilldownMember (
   {
    {
     DrilldownMember (
      {
       {
        DrilldownLevel (
         { [Dates].[Date].[All] }
         ,
         ,
         , INCLUDE_CALC_MEMBERS
        )
       }
      }
      , { [Dates].[Date].[YYYY].&[2014] }
      ,
      ,
      , INCLUDE_CALC_MEMBERS
     )
    }
   }
   , { [Dates].[Date].[YYYYPP].&[2014]&[2014P10] }
   ,
   ,
   , INCLUDE_CALC_MEMBERS
  )
 )
 ,

 { [Measures].[Orders Count], [Measures].[Net Amount], [Measures].[Ticket Avg] }

) DIMENSION PROPERTIES PARENT_UNIQUE_NAME
, HIERARCHY_UNIQUE_NAME
, [Dates].[Date].[YYYYPP].[YYYY]
, [Dates].[Date].[YYYYPPW].[YYYYPP]
 ON COLUMNS
, NON EMPTY CrossJoin (
 Hierarchize (
  {
   DrilldownLevel (
    { [Stores].[Market].[All] }
    ,
    ,
    , INCLUDE_CALC_MEMBERS
   )
  }
 )
 , Hierarchize (
  {
   DrilldownLevel (
    { [Mixes].[Mix].[All] }
    ,
    ,
    , INCLUDE_CALC_MEMBERS
   )
  }
 )
) DIMENSION PROPERTIES PARENT_UNIQUE_NAME
, HIERARCHY_UNIQUE_NAME ON ROWS
FROM (
 SELECT ( { [Dates].[Date].[YYYYPP].&[2014]&[2014P01] } ) ON COLUMNS
 , ( { [Stores].[Market].[Market Region Name].&[CHICAGO] } ) ON ROWS
 FROM [Orders]
)
WHERE ( [Stores].[Corp-Fran-Intl].[Corporate Franchise International].&[Corporate] ) CELL PROPERTIES VALUE
, FORMAT_STRING
, LANGUAGE
, BACK_COLOR
, FORE_COLOR
, FONT_FLAGS

1 个答案:

答案 0 :(得分:0)

如果您想在行上使用过滤器,则可以使用Excel的mdx工具创建自定义mdx集。然后你可以在数据透视表中使用命名集:

{filter(      
Hierarchize (
        DrilldownMember (
          DrilldownMember (
            DrilldownLevel (
             { [Dates].[Date].[All] }
            )
          , { [Dates].[Date].[YYYY].&[2014] }
          )
         , { [Dates].[Date].[YYYYPP].&[2014]&[2014P10] }
       )
      )
,[Measures].[Orders Count] <> 1
)}

或者,如果您要过滤自定义集的行可能是以下任一行:

{filter(
 Hierarchize (
   DrilldownLevel (
    { [Stores].[Market].[All] }
   )
 )
 ,[Measures].[Orders Count] <> 1
 )}

..或者这里......

{filter(
 Hierarchize (
   DrilldownLevel (
    [Mixes].[Mix].[All]
   )
 )
 ,[Measures].[Orders Count] <> 1
 )}