Add a count column to the query like shown below? If that is not what you are looking for, try the two other possibilities below that, that I have commented out:SELECT TOP ( 100 ) PERCENT dbo.T_Gateways.p_name , YEAR(dbo.T_LOG_Order_Gateway.orderdate) AS Y , MONTH(dbo.T_LOG_Order_Gateway.orderdate) AS M , DAY(dbo.T_LOG_Order_Gateway.orderdate) AS D , SUM(dbo.T_LOG_Order_Gateway.amount) AS SumAmount ,COUNT(*) AS NumOrders --,COUNT(DISTINCT T_LOG_Order_Gateway.Order_id) AS NumOrders --,COUNT(*) OVER () AS NumOrdersFROM dbo.T_LOG_Order_Gateway INNER JOIN dbo.T_Gateways ON dbo.T_LOG_Order_Gateway.gatewayid = dbo.T_Gateways.idGROUP BY YEAR(dbo.T_LOG_Order_Gateway.orderdate) , MONTH(dbo.T_LOG_Order_Gateway.orderdate) , DAY(dbo.T_LOG_Order_Gateway.orderdate) , dbo.T_Gateways.p_nameORDER BY Y , M , D