SELECT Month, ROUND(Sales,0)/1000 AS M_Sales, ROUND(AVG(Sales) OVER (ORDER BY Month ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),0)/1000 AS Moving_Avg_M_Sales FROM ( SELECT monthnumberofyear AS Month, ROUND(SUM(transactionprice*quantity),0) AS Sales FROM factonlinesales fos INNER JOIN dimdate dd ON fos.orderdatekey= dd.datekey WHERE calendaryear = 2024 GROUP BY monthnumberofyear ) ORDER BY 1, 2 ;