## how to calculate Average Time Duration

 Author Message suresh0534 Old Hand Group: General Forum Members Points: 395 Visits: 344 Hi,I am counting values from database likeTotal Calls Made:0:53:29 , Total Calls Received:0:11:25 , Total Call Duration:1:4:54Total Calls Made:43 , Total Calls Received:5 , Total Call Duration:1:4:54here how to calculate Average Time Duration:Total Time Duration / (Total Calls Made + Total Calls Received)(1995 +20214) / (43+5 )How can we calculate the Average time(In hrs:mm:ss)How can we calculate the Average time.Thanks Luis Cazares SSC-Dedicated Group: General Forum Members Points: 39632 Visits: 19795 Your formula seems correct but you don't have number or calls made or received, instead you have duration of them. Check your data and post again.:-) Luis C.General Disclaimer:Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?How to post data/code on a forum to get the best help: Option 1 / Option 2 fahey.jonathan Mr or Mrs. 500 Group: General Forum Members Points: 538 Visits: 400 To calculate "average duration", convert the duration for each record to milliseconds, then average the number of milliseconds for the group. Once you have that, then add that to a "zero" date and format it as time. In this example, the average milliseconds is the "12345" value:`SELECT CONVERT(VARCHAR(12), DATEADD(MILLISECOND, 12345, 0), 14) AS DurationDuration------------00:00:12:347`