currentmember.prevmember Function
Function:
currentmember.prevmember
Syntax:
([Measures].[<measure name>], <Time Dimension Name>.currentmember.prevmember)
Description:
This function enables you to make reference to the item preceding the current item according to the Time Dimension used. For example if we work on the year level, we can compare it to the previous year, if we work on the month level, we can compare it to the previous month etc.
Example: here the « measure name » measure is the TOTAL field and the « Time Dimension Name » dimension is the DATE.[by Month] dimension.
([measures].[Total]-([measures].[Total],DATE.[by Month].currentmember.prevmember))/ ([measures].[Total],DATE.[by Month].currentmember.prevmember)
This example can be improved using a conditional function to avoid division by zero or null fields:
IIF(([measures].[Total],DATE.[by Month].currentmember.prevmember)<>0,([measures].[Total]-([measures].[Total],DATE.[by Month].currentmember.prevmember))/([measures].[Total],DATE.[by Month].currentmember.prevmember),NULL)