What I am trying to see: A report of how many hours were worked by each agent on each ticket type, ordered by day. So that we can say "Agent A spent 6 hours on Customer Service tickets on Tuesday and 7 hours on Wednesday. So, he was mostly unavailable to complete any Internal tickets on those days" or "It looks like we are waiting until the end of the week to get our Maintenance ticket work completed, let's try to spread that out more throughout the week"
I have modified the existing "Helpdesk: Count of Tickets per Agent, Month and Type" to show the count per day instead of month. Now what I need is to change the "Count" to "Hours Worked" instead. I have tried swapping in the related Select/Convert/Join/Group/Order sections from other "Time Worked" reports but it is clear I am missing something. I am a SQL noob, so no surprise there.
Bonus points if you can limit it to the last 30 days of results. Thanks in advance to everyone who takes a look at this!
Here is what I have so far:
Select Top 1000000 DatePart(yyyy, htblticket.date) As Year,
DatePart(mm, htblticket.date) As Month,
DatePart(dd, htblticket.date) As Day,
htbltickettypes.typename Type,
htblusers.name As AssignedAgent,
Count(htblticket.ticketid) As TicketCount
From htblticket
Inner Join htblagents On htblagents.agentid = htblticket.agentid
Inner Join htblusers On htblusers.userid = htblagents.userid
Inner Join htbltickettypes On htbltickettypes.tickettypeid =
htblticket.tickettypeid
Group By DatePart(yyyy, htblticket.date),
DatePart(mm, htblticket.date),
DatePart(dd, htblticket.date),
htbltickettypes.typename,
htblusers.name
Order By Year Desc,
Month Desc,
Day Desc,
Type,
AssignedAgent