SELECT Year, Quarter, ROUND(Sales,0)/1000 Q_Sales, CustNum Q_Cust, ROUND(SUM(Sales) OVER (PARTITION BY Year),0)/1000 AS Y_Sales, SUM(CustNum) OVER (PARTITION BY Year) AS Y_Cust, AVG(CustNum) OVER (PARTITION BY Year) AS Avg_Q_Cust FROM ( SELECT calendaryear Year, calendarquarter Quarter, SUM(transactionprice*quantity) AS Sales, COUNT(DISTINCT customerkey) AS CustNum FROM factonlinesales fos INNER JOIN dimdate dd ON fos.orderdatekey= dd.datekey WHERE calendaryear = 2024 GROUP BY calendaryear, calendarquarter ) ORDER BY 1 ;