Discussion board where members can get started with Qlik Sense.
I am trying to calculate rolling average for 2 years data.
For example :
First 6 month Cost should be as it is
Average(Previous 6 months)
This should be Average of previous months based on current month
I want this in Script, not in Edit expression
Try something like this.
Put 6 instead of 24... Is this for last 6 months avg isnt fit....
Need to add in script, not in edit expression
On 25-Nov-2016 12:58 pm, "Jegadeesan Gopalakrishnan" <
Do the same in back end....
In Edit script "above" function it won't work.
Try it Peek function
Here you go :
// Your parameters
// Your data load
"Month" as Period,
(ooxml, embedded labels, table is Feuil1);
// Rest of script
recno() as PeriodID,
order by Period;
recno() as PeriodID_2,
Cost as Cost_2
Drop table Temp_Data1;
where PeriodID>=PeriodID_2-$(vNbOfMonthsToTakeInAvg) and PeriodID<=PeriodID_2;
Drop table Temp_Data2;
avg(Cost) as Cost,
Max(Period) as Period,
group by PeriodID_2;
Drop table Temp_Data3;
Thanks for the reply. While trying the above code, it's getting hanged. Is there any other way to do so?
Could you post your code ?
And a screenshot of the error ?