Referring to the previous item in a list is a nightmare: You can write a lookup to find the previous item, but as soon as you try to use it you get a circular reference. Sometimes you can get round this with creative use of the CUMULATE() function on your list, but sometimes you can't and you need to map your calculation onto the time dimension.
But if CUMULATE() can be used on a list, why not PREVIOUS()? It would be awesome to have a PREVIOUSITEM() function that allowed you to pick up a value from the previous item in a list, while letting Anaplan know that you're not creating a circular reference. You can be sure it's not a circular reference because the dependencies would always flow in the direction of the list, and it would solve all sorts of problems.
We're always saying "If you can do something in Excel, you can do it in Anaplan," but recursion is an example (possibly the only example?) of something that's simple in Excel but virtually impossible in Anaplan. Excel can handle recursive calculations on any dimension, but Anaplan can only really handle recursion over the time dimension. This would solve that.
PREVIOUSITEM(x, y) where
x: Any expression
The expression x must be based on the list y. PREVIOUSITEM(x, y) would then pick up the value of x from the previous item in the list y.
Anaplan would need to allow PREVIOUSITEM(x, y) to be used in the definition of x itself, in the same way as PREVIOUS(), without creating a circular reference.
I don't know if you're looking for it, but there's a way to do it currently, which works, albeit a bit complicated:
You can rank your list elements from 1 to x. then you create a module / line item over time, with a daily calendar. With your calculated rank, you can assign every element to a specific day. Then you are able to do all the time functions (previous included) on those line items.
A solve to this, without needing to use the time dimension, would be to create a seperate identical version of the list you are trying to reference, and enter a sequential range of numbers into the code. Then in a module dimensionalized by the original list, create a CODE(FINDITEM(List2, NAME(ITEM(List1)). This will find the item in the second list, and return the sequential number. Then subtract 1 from the VALUE of the code. Then FINDITEM on the CODE-1 line item to return the list item name. Then FINDITEM on the item name to return to your original list. This will give you the previous item.
I tried the below solution, that is definitely a good option. But some how we have another property for PREVIOUS() that it can be applied to the same line item. for ex: X = 1+Previous(X). when we use the below procedure we miss that facility provided by PREVIOUS().
I am not sure if I am missing any intermediate step. Please let me know.