Hi I need help working out how to calculate how many peak concurrent calls I have in a day from my CDR date stored in MySQL.
The data set looks like this:
Try adding +1 for each start of call, and -1 for each end, then just get cumulative sum of that +1/-1 column
***Convert the calldate if needed or use your format:
set @from:='2015-02-01';
set @to:='2015-03-01';
set @csum:=0;
SELECT DT,CallCount, (@csum := @csum + CallCount) as cumulative_sum
FROM
(select calldate AS DT, 1 AS CallCount
from cdr
where calldate between @from and @to
union all
select ADDDATE(calldate,INTERVAL duration SECOND) AS DT, -1 AS CallCount
from cdr
where calldate between @from and @to
) Calls
ORDER BY 1 asc;