Geting the nth previous value

Hi everybody.

I’m trying to get the previous value of an indicator, with the caveat that the number of elements I have to go back is provided by the user.

Something like this:

Previous(MyIndicator; MyVariable)

with MyVariable holding a number.

The problem is that Previous doesn’t seem to work with variables (if I replace MyVariable for a number I get the correct result)

What workaround could I use?

Thx!


scepas (BOB member since 2010-06-29)

Previous(MyIndicator; MyVariable)

Try this

=Previous(MyIndicator) where (MyIndicator=MyVariable)

Rajubollas :india: (BOB member since 2009-09-04)

Thanks Rajubollas.

I don’t think that would work though; MyVariable contains the number of positions I want to go back, and has nothing to do with MyIndicator.

If I have

Previous(MyIndicator; 10)

It would mean “give me the previous tenth value of MyIndicator”. I just want to replace this 10 with a variable, that I will fill with user input.

Hope I’m being a bit more clear now.


scepas (BOB member since 2010-06-29)

check the data type of value returned by your variable.

–Kuldeep


kuldeepchitrakar :india: (BOB member since 2009-03-03)

The variable is of type Number (as it’s supposed to be, according to the documentation of the function)

To be more precise, the error I get is:

“Incorrect reset context at position X (WIS 10072)”


scepas (BOB member since 2010-06-29)