USE OLAP
--Running total
SELECT year,month,total_sales
       ,sum(total_sales) over(order by year,month) as running_total
FROM sales_by_year_and_month
ORDER BY year,month

--Year to date
SELECT year,month,total_sales
       ,sum(total_sales) over(partition by year order by year,month) as year_to_date
FROM sales_by_year_and_month
ORDER BY year,month

--Comparison by month
SELECT year,month,total_sales
       ,sum(total_sales) over(partition by year order by year,month) as year_to_date
FROM sales_by_year_and_month
ORDER BY month --group all the months together
         ,year desc --displaying the most recent year first

