# QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

## How to calculate a Moving Range Average for a Xmr Chart

Hello,

I am trying to build a Xmr Chart with the data below. There is an Month/Year filter and I always calculate the Average and the Moving Range Average with the selected data only*.

But I am having a hard time to calculate de Moving Range Average, I always get an erron on the expression.

 Year/Month Sales Average * Moving Range Moving Range Avg 2012/10 100.038,59 105.023,83 17.884,04 ?? 2012/09 82.154,55 105.023,83 38.539,28 ?? 2012/08 120.693,83 105.023,83 3.485,48 ?? 2012/07 117.208,35 105.023,83 - ??

The Average I used the expression:  sum(total(Sales))/GetSelectedCount(Year/Month)

For the Moving Range:  fabs(sum(Sales)-below(sum(Sales)))

And for the Moving Range Avg I tried unsucessfully to use: sum(total(fabs(sum(Sales)-below(sum(Sales)))/GetSelectedCount(Year/Month)

Thank you very much.

Tags (2)
1 Solution

Accepted Solutions
Not applicable

## Re: How to calculate a Moving Range Average for a Xmr Chart

Could you try

Avg(total aggr(fabs(sum(Sales)- below(sum(Sales))),Year/Month))

^ This  will avg across thel range with values (count = 3)

OR

Avg

(total aggr(rangesum(fabs(sum(Sales)- below(sum(Sales)))),Year/Month

))

^ This one will avg across the full range (count = 4)

2 Replies
Not applicable

## Re: How to calculate a Moving Range Average for a Xmr Chart

Could you try

Avg(total aggr(fabs(sum(Sales)- below(sum(Sales))),Year/Month))

^ This  will avg across thel range with values (count = 3)

OR

Avg

(total aggr(rangesum(fabs(sum(Sales)- below(sum(Sales)))),Year/Month

))

^ This one will avg across the full range (count = 4)

Not applicable

## Re: How to calculate a Moving Range Average for a Xmr Chart

Ryan,

Thank you very much for you help. I used the first expression and it worked great.