...
It is selected based on a date range and then ordered by number and month
Monthly Call Volume
SELECT [bf_callStartDateLocal] / 100 AS month , [bf_calledNumber] AS DNIS, COUNT (*) AS callCount, CAST ( SUM (bf_billDuration) / 60.0 AS DECIMAL (8,2)) AS minutes
FROM [dbo].[BroadsoftCDRFact]
WHERE bf_direction = 'Terminating' AND [bf_answerIndicator] = 'Y' AND [bf_callStartDateLocal] >= 20210301 AND [bf_callStartDateLocal] < 20210501
GROUP BY [bf_callStartDateLocal] / 100, [bf_calledNumber]
ORDER BY month , DNIS;
|