Delen via


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

Reference

MDX Function Reference (MDX)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
  • Added updated examples.