TechNet
Export (0) Print
Expand All
Avg
IIf
Lag
Max
Min
Mtd
Qtd
Sum
Var
Wtd
Ytd
Collapse the table of content
Expand the table of content
Expand Minimize

PrevMember (MDX)

 

Updated: March 2, 2016

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

  
Member_Expression.PrevMember   

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

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

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])  

MDX Function Reference (MDX)

Community Additions

ADD
Show:
© 2016 Microsoft