Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
James_B
Contributor II
Contributor II

Average using previous weeks data

Hi All, 

could someone please assist me.

I am trying to eliminate the manual process of me having to use this formula within an excel sheet (as seen in picture below)

James_B_0-1621419976301.png

 

I would like Qlik to generate a figure based on the average form the previous 3 weeks and would need this to be a rolling average.

 

Thanks in advance 

 

James 

4 Replies
OmarBenSalem

It would be something like : 

aggr(rangeavg(
above(
Avg({<Week,date>} total <Week> worked)
,1,3))
,Week)

What this does : 

Part 1 : Avg({<Week,date>} total <Week> worked) : this calculates the Avg worked for each week.

The RanegAvg .. 1,3) part does calculate the avg of the Part 1 (of each week) starting from the week abve (1) and doing an avg of 3 weeks (3)

Result :

 

Capture.PNG

 

Example : in week 5 : it calculates the rangeavg of the avg of (week 4+week 3 + week 2) = avg (2.6 + 2.4 + 3.6) = 2.87 !

and with this, even if u select a date in week 5, it would still show u the avg of the week 5 (week of the selected date) : 2;87

Capture.PNG

James_B
Contributor II
Contributor II
Author

Hi Omar, 

 

Thank you for your reply but unfortunately this isn't working 

its producing the figure correctly 

 

Many thanks 

 

James 

 

James_B_2-1621495488603.png

 

James_B_4-1621495551729.png

these pictures show how excel work out the figure for me 

 

is it possible for Qlik to do the same to eliminate me having to do this in excel to populate my table?

 

Cheers 

 

James 

OmarBenSalem

What's not working? 

James_B
Contributor II
Contributor II
Author

It is not calculating the figure correctly and filling in all the blanks