2 Replies Latest reply: May 19, 2016 5:59 AM by Morne Schoeman RSS

    If statement loop

    Morne Schoeman

      Hi,

       

      Please assist. I have a table with transaction totals for vendors per period, I need to determine when the last transaction on a vendor took place. Below is an example:

       

      Thus last transaction for vendor 1: Period 3-2015; vendor 2- Period 2-2016

       

      Vendor          Year          Period1          Period2          Period3       

      1                   2016             0                     0                    0

      1                   2015          100                    0                   50

      1                   2014          150                 200                 250

      2                   2016             0                 150                     0     

      2                   2015          100                100                  100              

      2                   2014            50                100                  100

       

      I can determine this via if statement e.g.

       

      if(Period3>0,[Year]& '-' & 3,

      if(Period2>0,[Year]& '-' & 2

      if(Period1>0,[Year]& '-' & 1,

      0))) AS [LAST TRANS]

       

      I am not an experienced QlikView user and I was wondering whether I can't use loops instead (i.e. loop through period columns)  to accomplish this and how I will go about doing this?

       

      Thank you in advance