Uredi

Deli z drugimi prek


PrevMember (MDX)

Returns the previous member in the level that contains a specified member.

Syntax

  
Member_Expression.PrevMember   

Arguments

Member_Expression
A valid Multidimensional Expressions (MDX) expression that returns a member.

Remarks

The PrevMember function returns the previous member in the same level as the specified member.

Example

The following example shows a simple query that uses the PrevMember function to display the name of the member immediately before the current member on the rows axis:

WITH MEMBER MEASURES.PREVMEMBERDEMO AS

[Date].[Calendar].CURRENTMEMBER.PREVMEMBER.NAME

SELECT MEASURES.PREVMEMBERDEMO ON 0,

[Date].[Calendar].MEMBERS ON 1

FROM [Adventure Works]

The following example returns the count of the resellers whose sales have declined over the previous time period, based on user-selected State-Province member values evaluated using the Aggregate function. The Hierarchize and DrillDownLevel functions are used to return values for declining sales for product categories in the Product dimension. The PrevMember function is used to compare the current time period with the previous time period.

WITH MEMBER Measures.[Declining Reseller Sales] AS   
   Count(  
      Filter(  
         Existing(Reseller.Reseller.Reseller),   
            [Measures].[Reseller Sales Amount] < ([Measures].[Reseller Sales Amount],  
            [Date].Calendar.PrevMember)  
            )  
         )  
MEMBER [Geography].[State-Province].x AS   
   Aggregate (   
      {[Geography].[State-Province].&[WA]&[US],   
      [Geography].[State-Province].&[OR]&[US] }   
         )  
SELECT NON EMPTY Hierarchize (  
   AddCalculatedMembers (  
      {DrillDownLevel({[Product].[All Products]})}  
         )  
   )  
        DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS   
FROM [Adventure Works]  
WHERE ([Geography].[State-Province].x,   
    [Date].[Calendar].[Calendar Quarter].&[2003]&[4],  
    [Measures].[Declining Reseller Sales])  

See Also

MDX Function Reference (MDX)