# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for
Did you mean:
Contributor III

## 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 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

Please let me know if you have suggestions.

Regards,

Shakila D

6 Replies
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.

Contributor III
Author

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

Why are you looking another way?

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)

what if there is just 2 Previous day?

Specialist II

Maybe something like the below

a:
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

FileDate as FileDate1 ,

date(FileDate-\$(i)) as FileDate

Resident a ;

NEXT

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

Master

Hi Shakila,

Try:

Data:

[File Date],

Size,

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

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

Community Browser