Skip to main content
Question

Previous (Month) VS Previous (Month ON - Rank)

  • May 14, 2025
  • 2 replies
  • 57 views

Forum|alt.badge.img+2

Can someone give me an example of when we should use previous VS previous on? Such as, previous(month) VS

PREVIOUS(Month ON -RANK(Month.'Start Date')

2 replies

Stef
Employee
Forum|alt.badge.img+12
  • Employee
  • May 14, 2025

Hi ​@Nusayba ,

You can use the ON parameter if you want to use an alternative order of your dimension. By default the previous (and also other functions like lastnonblank or firstnonblank) follow the natural order of your dimension. 
If you want to use a different order, instead of re-ordering the list, you can use the ON parameter.

Hope this helps,


Min Li
Master Helper
Forum|alt.badge.img+12
  • Master Helper
  • May 14, 2025

PREVIOUS(Dimension, offset)

Dimension of the current source metric on which we would like to apply an offset

offset (optional) is an integer N that allows returning the Nth value before. By default, the value is 1.

PREVIOUS(Dimension ON -RANK(dimension.Rank_Property), offset)

dimension.Rank_Property is a NUMBER, INTEGER, DATE Property that can be naturally ordered with the RANK() function. This expression will reverse the rank of the Dimension items, and results will go backward (in the opposite direction as if you were doing PREVIOUS(Dimension) )