MDX过滤数据

时间:2015-04-22 03:04:39

标签: mdx

WITH 
MEMBER [Measures].[ParameterCaption] AS  [Estate].[Week].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[ParameterValue] AS  [Estate].[Week].CURRENTMEMBER.UNIQUENAME 
MEMBER [Measures].[ParameterLevel] AS  [Estate].[Week].CURRENTMEMBER.LEVEL.ORDINAL 

SELECT 
{[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS 
, 
NON EMPTY ( 
ORDER (
    EXCEPT( [Estate].[Week].[ALL].CHILDREN
    , { [Estate].[Week]}) 
, ( [Estate].[Week].MEMBERVALUE)
, ASC
) 
) ON ROWS 
From  [EstateRpt]
WHERE Filter([V Estate Weekly Rpt].[Week].CHILDREN, [V Estate Weekly Rpt].[Week].MEMBERVALUE = 'NONE')

嗨,我是MDX的新手。我想过滤不等于“无”的一周?默认情况下,将周设置为“NONE”,因此它将在多维数据集中显示NONE数据。我想过滤一下这个。

我尝试WHERE子句,但它向我显示错误,我不知道是什么问题

1 个答案:

答案 0 :(得分:0)

如果您要过滤掉'NONE',则需要在过滤器中使用此功能:

 <> 'NONE'

此外,您需要在过滤器中使用CurrentMember,如下例所示:

SELECT 
    {
      [Date].[Calendar].[Month].&[2006]&[7]
     ,[Date].[Calendar].[Date].&[20050220]
    }
  * 
    {[Measures].[Reseller Sales Amount]} ON COLUMNS
 ,
    {[Product].[Category].Children}
  * 
    {[Geography].[Geography].[Country].MEMBERS} ON ROWS
FROM [Adventure Works]
WHERE 
  Filter
  (
    [Geography].[State-Province].MEMBERS
   ,
    [Geography].[State-Province].CurrentMember.Member_Caption <> 'California'
  );