Hi All
Need help in finding out total sum of lottery wins in one week along with 12 week rolling data. I am attaching a snapshot of the data. I have found the sum of lottery wins per market split by last day of week, but not sure how to find out rolling 12 week data.
I am attaching excel screenshot
I have done the sum of finding lottery wins per week
SQL Code:-
select last_day_of_week,MARKET,sum(real_gw)
from data_imp
where LAST_DAY_OF_WEEK between dateadd(day,-77,last_day_of_week) and LAST_DAY_OF_WEEK
group by LAST_DAY_OF_WEEK,market
I am not sure how do i find out rolling 12 weeks based on this date range. If you see the excel screenshot the way to find rolling 12 week is explained in the formula bar.
My end result should be a display of last_day_of_week,market,total,total of rolling 12 week data all in one sql query as you see in the excel screenshot
Would appreciate all helps given
Regards
Farhan Jamil