Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mabryanjr
Contributor
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)
1 Reply
Mario_De_Felipe
Luminary
Luminary

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]))