Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

New Contributor III

How to select the previous value?


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?

2 Replies
Not applicable

Re: How to select the previous value?

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?

Try maybe something like

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

Community Browser