SELECT Heure, ROUND(AVG(nbAppels),2) nbAppelsMoyen
FROM
(
SELECT DATE_PART('day',eventtime) Jour, DATE_PART('hour',eventtime) Heure, count(DISTINCT cid_name) nbAppels
FROM cel
WHERE eventtime >= '2016-02-01 00:00:00'
AND eventtime < '2016-03-01 00:00:00'
AND eventtype = 'CHAN_START'
AND context = 'from-extern'
GROUP BY DATE_PART('day',eventtime), DATE_PART('hour',eventtime)
ORDER BY 1,2
) t1
GROUP BY Heure
ORDER BY 1