ServiceDesk

 View Only

Service Desk - Time Spent per User

  • 1.  Service Desk - Time Spent per User

    Posted Sep 19, 2013 10:20 AM

    I have searched for this solution for a while and after some guidance from Damon I was able to come up with the following.

    This will give you a list of all users that resolved a ticket between the @StartDate and @EndDate.  They are listed by email, first, then last name.  There are 2 parts to the Time Spent.  The columns labeled Days and H:M:S are split because of formating limitations and the last column is a sum of seconds.  Feel free to use this as needed and respond if you see areas for improvement or if I have made an error.

    DECLARE @StartDate datetime
                   ,@EndDate datetime
    SET @StartDate = '2012-07-01'
    SET @EndDate = '2013-07-01'
    SELECT [u].[PrimaryEmail]
          ,[u].[FirstName]
          ,[u].[LastName]
          ,case 
                when (SUM(rpt.[TimeSpent]) > 86400) then ((SUM(rpt.[TimeSpent]))/86400)
                else '0'
           end as [Days]
          ,CONVERT(varchar(10), DATEADD(second, SUM(rpt.[TimeSpent]), 0), 108) AS [H:M:S] 
          ,SUM(rpt.[TimeSpent]) AS [Seconds]
      FROM [ReportProcessTiming] rpt
    left join [ReportProcess] rp on rpt.[SessionID] = rp.[SessionID]
    left join [ServiceDeskIncidentManagement] sd on rp.ReportProcessID = sd.process_id
    inner join [User] u on u.UserID = sd.resolved_by_user_id
    where
    (rp.Result in('Closed') 
     or rp.Result in('Subtasks Completed')
     or rp.Result in('Success')
       and rp.ProcessEnded > @StartDate
       and rp.ProcessEnded < @EndDate
    group by [u].[PrimaryEmail], [u].[FirstName], [u].[LastName]
    order by [Days] desc, [H:M:S] desc