PrevMember

Using the order of members existing in a database outline, returns the previous member along the same generation or level.

Note:

When multiple hierarchies are enabled, this function returns NULL when the source member is in one hierarchy and the result member belongs to a different hierarchy.

Syntax

member.PrevMember [( layertype ) ]
PrevMember ( member [,layertype ] )
ParameterDescription

member

The starting member from which PrevMember counts one member back.

layertype

GENERATION or LEVEL. The default is Generation.

Example

Example 1

The following expression

 [Jun].prevmember

returns the member that is 1 step prior to Jun:

[May]

Example 2

The following query

/* 
For January, PrevMember doesn't exist
For December, NextMember doesn't exist
*/

WITH 

MEMBER 
 [Measures].[Delta from Previous Month] 
AS 
 ' [Measures].[Sales] - 
  ([Measures].[Sales],[Year].CurrentMember.PrevMember)
 '

MEMBER [Measures].[Delta from Next Month]
AS
 ' [Measures].[Sales] - 
  ([Measures].[Sales], [Year].CurrentMember.NextMember)
 '

SELECT
 { [Measures].[Sales], 
   [Measures].[Delta from Previous Month], 
   [Measures].[Delta from Next Month] 
 }
ON COLUMNS,

 [Year].Levels(0).Members
ON ROWS

FROM Sample.Basic
WHERE 
 (
  [Scenario].[Actual], 
  [Market].[East], 
  [Product].[100]
 )

Returns the grid:

(axis)SalesDelta from Previous MonthDelta from Next Month
Jan2105210544
Feb2061-44-65
Mar212665-132
Apr2258132-89
May234789-278
Jun2625278-110
Jul273511062
Aug2673-62311
Sep2362-311268
Oct2094-26828
Nov2066-28-222
Dec22882222288

See Also