Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Expert,
i have scripcode wise Week wise sales information. i want load those data to Qlikview Application and also want 10 Weeks rolling moving avg and 39 Weeks rolling moving avg along with that.
i am sharing you a sample excel for ready reference. In Excel i have already added 10week rolling moving Avg and 39 Week rolling moving avg for your reference purpose. which i want to calculate while loading the data.
the sample file contain only one scripcode in original there are many scripcode.
Thanks & Regards,
JKV
Hi All,
i have found a better way to do rolling Avg on load script.
1) First i have done Scrip code wise cummlative sum of all Weeks.
2) After that when my Rolling Week count reach i subtract cumulative sum from the 5 record backs cumlative sum and divide by 5 so i get rolling avg of 5 Week.
tbl_Cumm:
load *,
if([Scrip Code]=Peek([Scrip Code]) and TradingWeekSeqNo>5,([Cumm Close Rate]-Peek([Cumm Close Rate],-5))/5,[Cumm Close Rate]/TradingWeekSeqNo ) as Rolling ;
load [Scrip Code],
TradingWeekSeqNo,
[Close Rate],
if( [Scrip Code]=Peek([Scrip Code]),RangeSum([Close Rate],peek([Cumm Close Rate])),[Close Rate]) as [Cumm Close Rate]
Resident tbl_Weeklytrade where [Scrip Code]>=500000 and [Scrip Code]<=599999 order by [Scrip Code],TradingWeekSeqNo
One point i forget to add that is i want to consider the missing Week also in the count.
for example if scripcode is not sales in a particular week then also that week will consider in count.
Hi,
If you want this in Chart Level, You can try like..
RangeAvg (above(sum(sales),0,10))
and
RangeAvg (above(sum(sales),0,39))
Check the Attachment.
You can refer the below Link also:
Calculating rolling n-period totals, averages or other aggregations
Hi Settu,
Thanks for you reply. i dont want to do that at chart level. because i have to do lots of historical analysis at load level only on the basis of the data.
Hi All,
i have found a better way to do rolling Avg on load script.
1) First i have done Scrip code wise cummlative sum of all Weeks.
2) After that when my Rolling Week count reach i subtract cumulative sum from the 5 record backs cumlative sum and divide by 5 so i get rolling avg of 5 Week.
tbl_Cumm:
load *,
if([Scrip Code]=Peek([Scrip Code]) and TradingWeekSeqNo>5,([Cumm Close Rate]-Peek([Cumm Close Rate],-5))/5,[Cumm Close Rate]/TradingWeekSeqNo ) as Rolling ;
load [Scrip Code],
TradingWeekSeqNo,
[Close Rate],
if( [Scrip Code]=Peek([Scrip Code]),RangeSum([Close Rate],peek([Cumm Close Rate])),[Close Rate]) as [Cumm Close Rate]
Resident tbl_Weeklytrade where [Scrip Code]>=500000 and [Scrip Code]<=599999 order by [Scrip Code],TradingWeekSeqNo