0 Replies Latest reply on Mar 13, 2013 3:50 PM by Minh Nguyen

    Previous values + Lookup function

    Minh Nguyen

      Hi all,


      I am looking for a pattern in a sequential numbers which is true based on some conditions, for now I used the LOOKUP function and it works but slowly due to the function and code.


      I created a calculated field "4 period" as


      if sum([Growth dummy > x%])=1

      and LOOKUP(sum([Growth dummy > x%]),-1)==1

      and LOOKUP(sum([Growth dummy > x%]),-2)==1

      and LOOKUP(sum([Growth dummy > x%]),-3)==1

      then 1 else 0



      - Is there a better way of doing this by using previous_value function or some other function?

      - How can we do loop in a calculated field? For example, I have a parameter, can I code like this?


      for i=1(1)parameter {

           if LOOKUP(sum([Growth dummy > x%]),-i)==1 then 1 else 0



      Many thanks,