1 Reply Latest reply: Jan 19, 2014 11:16 AM by Gysbert Wassenaar RSS

    previous record existing

      Hi guys,

      Could you please with one calculation in a script. In attached qvw example I have two column %userid and register_data. In result, I would like to get column is_repeated which represent 0 or 1 . If current record have previous records where current register_date > previous register_date records for defined userid then 1 else 0. Desired result in picture.

      Thank you very much for any help.

        • Re: previous record existing
          Gysbert Wassenaar

          If your source data already is ordered by register_date you can simply use the exists function:


          Load %userid, register_data, if(exists(%userid),1,0) as is_repeated

          from ...

           

          If your source data is not ordered by register_date you need to do that first and at the same time you can create the is_repeated field with the previous function.

           

          see attached qvw.