PrevMember
Using the order of members in an Essbase outline, the MDX PrevMember() function returns the previous member along the same generation or level. 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 ) ]
or
PrevMember ( member [,layertype ] )
Parameters
- member
-
The starting member from which PrevMember counts one member back.
- layertype
-
GENERATION
orLEVEL
. The default is Generation.
Example 1
The following MDX expression returns [May], which is one step prior to Jun:
[Jun].prevmember
Example 2
The following MDX 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 following output:
Table 4-122 Output Grid from MDX Example
(axis) | Sales | Delta from Previous Month | Delta from Next Month |
---|---|---|---|
Jan | 2105 | 2105 | 44 |
Feb | 2061 | -44 | -65 |
Mar | 2126 | 65 | -132 |
Apr | 2258 | 132 | -89 |
May | 2347 | 89 | -278 |
Jun | 2625 | 278 | -110 |
Jul | 2735 | 110 | 62 |
Aug | 2673 | -62 | 311 |
Sep | 2362 | -311 | 268 |
Oct | 2094 | -268 | 28 |
Nov | 2066 | -28 | -222 |
Dec | 2288 | 222 | 2288 |