# App Development

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for
Did you mean:
Contributor

## Calculate the Average of Running Difference

I have data that looks like this:

 Week Ending Count Moving Range Avg MR 2021-09-18 235 2021-09-25 223 22 2021-10-02 211 12 2021-10-09 218 7

I can get the running difference using the fabs and above functions:

fabs(Column(1) - Above(TOTAL Column(1)))

What I am trying to accomplish is to have the data in the Avg MR column equal 13.67.  (22+12+7)/3

My approach so far has been to use an aggr average on the Moving Range, but it only returns null values.

avg(total aggr(fabs(Column(1) - Above(TOTAL Column(1))), [Week Ending]))

Any help is much appreciated!

Labels (1)
• ### General Question

Luminary Alumni

Hi @mabryanjr ,

you could use RangeAvg :

1) Label your measure fabs(Column(1) - Above(TOTAL Column(1))) as "Dif"

2) Add new measure, name it "Average" and set expression  RangeAvg([Dif],above([Average]))

Tags
Community Browser