开发者

How to get first level data members after apply filter in third level (Mondrian MDX)

I am having a dimension named PERIOD with three levels YEAR, QUARTER and MONTH.

I have filtered out third level data as follows:

With SET [*BASE_MEMBERS_Period.Period] AS ' Filter ( [Period.Period].[Month].Members , (NOT( [Period.Period].CurrentMember In { [Period].[All Periods].[FY 2008-2009].[Q4 2008-09].[Mar 2009 ] } ) ) ) ' 

That means, we want all data except [Mar 2009开发者_JAVA技巧 ].

Now, I have to write query for the following requirements:

  1. to get the data for all the members of YEAR level...by applying the filter above. That means...the value for the member [FY 2008-2009] should come after excluding value of [Mar 2009].

  2. to get the data for all the members of QUARTER level...by applying the filter above. That means...the value for the member [Q4 2008-09] should come after excluding value of [Mar 2009].

Thanks in advance.


Not sure about Mondrian, but if it's MDX compliant:

First, you can write your set with the - operator :

With SET [*BASE_MEMBERS_Period.Period] AS '[Period.Period].[Month].Members - [Period].[All Periods].[Mar 2009 ]'

In order to have the behavior you're looking for you can use a subselect :

Select
 [Period.Period].[Year] on 0
From
  (Select 
    [Period.Period].[Month].Members - [Period].[All Periods].[Mar 2009 ] on 0 
    from [MyCube] )

As you can see from the results, March 2009 data is removed. Subselect does not only apply to fact data (see the VISUAL flag) but also to mdx functions. You can check the following statement where the month is filtered also from the members function :

Select
 [Period.Period].[Month].members on 0 // -> March 2009 is not there
From
  (Select 
    [Period.Period].[Month].Members - [Period].[All Periods].[Mar 2009 ] on 0 
    from [MyCube] )
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜