Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

curiousfellow
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
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
curiousfellow
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 valuerunning total
2017-05 1010
2017-06 2030
2017-07 3060
2017-08 40100
2017-09 50150
2017-10 60210
2017-11 70280
2017-12 80360
2018-01 90450
2018-02 100550
2018-03 110660
2018-04 120770
2018-05 130880
2018-06 140990
2018-07 1501100