# QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

## Average of all preceding values

Hey!!

I would like to plot the following expression:

$z_i = \lambda \bar x_i + \left ( 1 - \lambda \right)z_{i - 1}$.

For that I need the average of all preceding values. My dimension is a column with dates (days).

{1-$} means just 'all data excluded by user selection'. Not applicable ## Re: Average of all preceding values Thank for your help! But I don't understand how to use above and before in this case. In my chart I want a value for each day. So for each day I need the average of L_Z1V1 (avg(L_Z1V1)) and the average of all preceding days... How can I calculate this?? Thank you very much!!! Eduardo Not applicable ## Re: Average of all preceding values Thank for your help! But I don't understand how to use above and before in this case. In my chart I want a value for each day. So for each day I need the average of L_Z1V1 (avg(L_Z1V1)) and the average of all preceding days... How can I calculate this?? Thank you very much!!! Eduardo Honored Contributor II ## Re: Average of all preceding values Hi. You could try something like this (similar as manual accumulation). =rangeavg(above(Sum(Value), 0, rowno())) Not applicable ## Re: Average of all preceding values Hey! Thank you for your help! But I still have some problems... In my chart I use as dimension: "days". The thing is that I have more than one value per day. So my rangeavg(...) should take all the values preceding the day in which I am calculating.  Datum L_Z1V1 2012.01.03 16:03:55 0,41 2012.01.03 20:31:43 0,434 2012.01.03 23:13:58 0,42 2012.01.04 13:56:06 0,431 2012.01.04 16:21:06 0,455 2012.01.04 22:14:28 0,45 2012.01.04 22:20:31 0,437 2012.01.04 22:26:45 0,448 2012.01.04 22:35:22 0,437 2012.01.04 23:16:09 0,449 2012.01.11 10:10:07 0,449 2012.01.11 10:37:04 0,422 For the first value rangavg should deliver 0. For the second value, rangavg should deliver the average value of all the values of 2012.01.03. I dont konw if I am explaining properly my doubt... Thank you for your help!! Eduardo Honored Contributor II ## Re: Average of all preceding values In this case you could use aggr() function. But it uses loading sort-order. You could perform the calculation in script. Not applicable ## Re: Average of all preceding values At the beginning I wanted to use aggr functions. I tried 1-$ but it is not what I need... I runned out of ideas..

Thank you for your effort!!

Eduardo

Honored Contributor II

## Re: Average of all preceding values

There is aggr() function that you could use to iterate over all your values during a day.

While at the begining you've tried aggregation functions (avg) with set analysis expression.

Not applicable

## Re: Average of all preceding values

Thank you very much for your time but I still don't know how to express that I want the average of the previous days...

Thank you!

Eduardo