Jump to content

Recommended Posts

Below shows the AHT (average handling time), avg acw, and avg. hold time.

I used the AVG(field) sql function.

The problem? --> It doesn't count the seconds properly. also, i haven't figured out a way to format it as a timestamp yet.

 

 

statscs.jpg

 

 

avg.jpg

 

Query is below:

 


$sql3 = "SELECT TeamLeader, AgentName, EmpID, AvayaID, date, SUM(StaffedTime), AVG(AHT) , ACDCalls,  SUM(ACDTime) , AvgACDTime, SUM(ACWTime),  AVG(AvgACWTime),  HoldCalls, HoldTime,  AVG(AvgHoldTime),  OutboundCalls , SUM(OutboundTime) , SUM(AvailTime),  RingTime,  AvgRingTime,  AVG(utilization), SUM(aux1), SUM(aux2), SUM(aux7), SUM(aux8), SUM(aux9) FROM import_stats WHERE EmpID = '$agent' and import_stats.date BETWEEN '$start' AND '$end' GROUP BY AgentName";
$result3 = mysql_query($sql3) or die(mysql_error());
$row3= mysql_fetch_array($result3);            

//AVERAGES
$utilization = $row3['AVG(utilization)'];
$aht = $row3['AVG(AHT)'];
$acw = $row3['AVG(AvgACWTime)'];
$holdtime = $row3['AVG(AvgHoldTime)'];         

$util = round($utilization);
$aht = round($aht);
$acw = round($acw);
$holdtime = round($holdtime);

Link to comment
https://forums.phpfreaks.com/topic/185047-avgtime-problemplease-help/
Share on other sites

Time in the format 00:00:00 is a mixed number base and you cannot directly do any math on it. You need to convert it into a single number base (i.e. seconds) in order to do math on the value, then convert it back to a time format. See the mysql TIME_TO_SEC() and SEC_TO_TIME() functions.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.