SELECT Month, ROUND(Sales,0)/1000 AS M_Sales, ROUND(AVG(Sales) OVER (ORDER BY Month ROWS 2 PRECEDING),0)/1000 AS Moving_3_M_Avg_Sales FROM ( SELECT monthnumberofyear 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 ;