2 Replies Latest reply: Apr 4, 2014 1:07 PM by Stefan Wühl RSS

    How to select the previous value?

    Ruytter Mendonça

      Hi.

       

      I want to see how many days between my clients sales.

      I tried to use =avg(aggr(Date-Above(Total Date),Client,Date)) but it doesn't work well.

       

       

      I want to achieve somenthing like this:

      Sem título.png

       

       

      Can some one help-me?

        • Re: How to select the previous value?
          Christian Ventrigli

          Maybe this will point you in the right direction, from the QV help manual...

           

          previous(expression )

          Returns the value of expression using data from the previous input record that was not discarded due to a where clause. In the first record of an internal table the function will return NULL. The previous function may be nested in order to access records further back. Data are fetched directly from the input source, making it possible to refer also to fields which have not been loaded into QlikView, i.e. even if they have not been stored in its associative database.

          • Re: How to select the previous value?
            Stefan Wühl

            Try maybe something like

             

            =avg( aggr( (max(Date)-min(Date)) / (count(Date)-1), [Sales man], Client))