Calculating Rolling Monthly Total
Hi
I am having trouble calculating the 6 month rolling total with SQL of this table
I've got in Table.1 something like this
Customer Name | Month of Sale | Revenue in the Month
X Co | Jan 2016 | $5,000
X Co | Feb 2016 | $4,000
Y Co | Jan 2016 | $8,000
Y Co | Mar 2016 | $1,000
Z Co | Dec 2015 | $800
Z Co | Feb 2016 | $2,800
.....
.....
.....
I want to create a table that looks like:
Month of Sale | Last 6 Months Rolling Revenue
Dec 2015 | $x
Jan 2016 | $x
Feb 2016 | $x
Mar 2016 | $x
In this table, the Dec 2015 6 month rolling revenue will be:
Jul 2015 + Aug 2015 Rev + Sep 2015 Rev + Oct 2015 ... + Dec 2015
Thanks