Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rolling 30 days Average in script for each date

Hi Team,

I would like to calculate the Rolling 3 days average in Qlikview script based upon the File date.

If we take it the File Date - 01/05/2017, it should calculate the average of last 3 days like as sum(684,458,235)/3 =459

Here is My data set.

  

File DateSize
01-01-2017121
01-02-2017235
01-03-2017458
01-04-2017684
01-05-2017453
01-06-2017159
01-07-2017147
01-08-2017596
01-09-2017999
01-10-2017100
01-11-2017158

Please let me know if you have suggestions.

Regards,

Shakila D

6 Replies
sergio0592
Specialist III
Specialist III

In your chart syntax, you can try with :

RangeAvg(Below(Size,-1,3))

I can't manage to use Below() in script but apparently this function works in script.

Anonymous
Not applicable
Author

Yes, I have to implement this logic in script. Is any other way to implement?

Anil_Babu_Samineni

Why are you looking another way?

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Kushal_Chawda

what if there is just 2 Previous day?

qliksus
Specialist II
Specialist II

Maybe something like the below

a:
LOAD *  INLINE [  
    FileDate, Size
    01/01/2017, 121
    01/02/2017, 235
    01/03/2017, 458
    01/04/2017, 684
    01/05/2017, 453
    01/06/2017, 159
    01/07/2017, 147
    01/08/2017, 596
    01/09/2017, 999
    01/10/2017, 100
    01/11/2017, 158
];


for i = 1 to 3

load

FileDate as FileDate1 ,

date(FileDate-$(i)) as FileDate

Resident a ;

NEXT

And use the Filedate1 in the chart to do the average calucaltion

effinty2112
Master
Master

Hi Shakila,

Try:

Data:

Load

[File Date],

Size,

Rangesum(Size,Peek(Size),Peek(Size,-2)) as AccSize;

LOAD * INLINE [

    File Date, Size

    01-01-2017, 121

    01-02-2017, 235

    01-03-2017, 458

    01-04-2017, 684

    01-05-2017, 453

    01-06-2017, 159

    01-07-2017, 147

    01-08-2017, 596

    01-09-2017, 999

    01-10-2017, 100

    01-11-2017, 158

];

giving:

File Date Size AccSize
01-01-2017121121
01-02-2017235356
01-03-2017458814
01-04-20176841377
01-05-20174531595
01-06-20171591296
01-07-2017147759
01-08-2017596902
01-09-20179991742
01-10-20171001695
01-11-20171581257

Regards

Andrew