Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tracycrown
Creator III
Creator III

Rolling Total

 

 

Dear sir/madam

Kindly help to advise how to  write a script to compute rolling total sales.

Photo-1.PNG

Thank you so much

Tracy

8 Replies
arpitkharkia
Creator III
Creator III

Hi,

 

PFA, i hope this helps!

tracycrown
Creator III
Creator III
Author

Dear Arpitkharkia

Many thanks for your quick response.

I have select only year 2014 but the chart still show all data in 2013, kindly advise asap.

Thank you

Tracy

slsaagar
Contributor II
Contributor II

PFA QV File.

hope this helps..

tracycrown
Creator III
Creator III
Author

Dear Slaagar

Sorry to say that this is not what I want, thanks for your help.

Please note that the rolling total column in the Test-1.xls is just an example to illustrate the formula and correct answer of Rolling Total.  In other word, you should use Sales data to derive Rolling Total in the script to plot the chart.

The script advised by Arpitkharkia is CORRECT but unforfortually it shows Rolling Totals for "ALL" dates from year 2013 to 2014 and unable to  provide Rolling Totals for selected date range (eg. only 2014).

Thank you

Tracy

 

arpitkharkia
Creator III
Creator III

Hi Tracy,

Sorry for the delay in response. PFA the updated qvw. This may not be the best solution but its giving the desired result.

Thanks!

Arpit

tracycrown
Creator III
Creator III
Author

Dear Arpit

This is not the correct answer.

If I select date range from Dec 31, 2013 to Dec 31, 2014, your 2nd qvw cannot get $7,310 on Dec 31, 2013 (same as my excel worksheet in Test-1.xls).

Your 1st qvw gave the correct answer $7310 but cannot select data range, kindly help asap.

Thank You

Tracy 

 

Gysbert_Wassenaar

See this document for solutions: https://community.qlik.com/t5/QlikView-Documents/Calculating-rolling-n-period-totals-averages-or-oth...

talk is cheap, supply exceeds demand
tracycrown
Creator III
Creator III
Author

Dear Gysbert

Thank you very much for sharing with me such a comprehensive discussion on Rolling Total, great effort has been put in the research to benefit the QV community.

It seems to me that your definition and formula of Rolling 3 months Total is different from mine (Tracy) as follows :

1. Nothing shown in row 1 & 2 as Month < 3

2. Month 3 = 17 = Total of rows from 1 to 3 (6+4+7) 

3. Month 4 = 14 = Total of rows from 2 to 4 (4+7+3) 

MonthAmountRolling 3Rolling 3 
  GysbertTracy
166 
2410 
371717
431414
541414
691616
751818
872121
982020
1062121
1192323
1272222

 

Both answers are the same, kindy advise what script should I change to eliminate data in rows 1 & 2 and not sure whether the answers will be the same for Rolling Total 12 Months?.

Thank You

Tracy