Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
date,amount
1/1/2014,100
2/1/2014,200
4/1/2014,300
5/1/2014,400
6/1/2014,500
7/1/2014,
8/1/2014,700
9/1/2014,
10/1/2014,900
11/1/2014,1000
12/1/2014,
13/1/2014,1200
14/1/2014,1300
15/1/2014,1400
here i want calculate for rolling 5 days avg for sum(amount) ?
how to calculate it?
Hi, please check attachment, hope this helps
i am using personal edition pls give me expression here
Hi,
Try like
Avg({<Datefield={">=$(=Date(max(date)-5))<=$(=Date(max(date)))"}>}Sales)
IF dateField is not in date format then use below code in script to convert it into date
Date(Date#(date,'DD/MM/YYYY'),'DD/MM/YYYY')
Regards,
=Avg({<date={">=$(=Date(max(date)-5)))"}>}amount)
See this document: Calculating rolling n-period totals, averages or other aggregations
it will give for only max date .
in my above data for every date it should calculate rooling avg
Rangesum(above(sum(amount),0,5))/5
what is the representation of '0' here
you could use 0 using if
using if (len(amount)=0,0,amount);
or null handling
NullAsValue amount;
Set NullValue = 0 ;
hope this helps