# New to QlikView

Discussion board where members can get started with QlikView.

Contributor II

## sum with analysis previous 11 periods and current period

I have to calculate a running average over one year for each period. Because not every dimension has values for every period, and the values of every period are not shown I cannot use the above function.

fields in my simplified example company, period, yearmonthnum and value.

So I made an expression like this

=sum({<company={'=yearmonthnum > yearmonthnum-11'}>} value), but then I don't get any result.

2 Replies
Partner

## Re: sum with analysis previous 11 periods and current period

Try the expression
=sum({<
yearmonthnum={">=\$(=max(yearmonthnum)-11)"}>} value)
Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Contributor II

## Re: sum with analysis previous 11 periods and current period

Thank you for your answer, but I didn't get the result that I expect. With your expression I only get a correct result when period is not used as dimension.

When I select company A , I expect to see something like this (without the value column)

 period value running total 2017-05 10 10 2017-06 20 30 2017-07 30 60 2017-08 40 100 2017-09 50 150 2017-10 60 210 2017-11 70 280 2017-12 80 360 2018-01 90 450 2018-02 100 550 2018-03 110 660 2018-04 120 770 2018-05 130 880 2018-06 140 990 2018-07 150 1100