I need to show a result of the top 10 branches of a store, which have seen greater monthly sales in February than January.
My columns look like this -
BranchID SaleDate SaleAmount
I tried partitioning by both branchid and the month of salesdate, but I'm not sure how to incorporate grouping along with partitioning.
select branchid, datepart(month, saledate) as month, sum(saleamount) over (partition by datepart(month, saledate), branchid order by saledate) as 'Monthly Sales' from sales