Conversation query report

Conversation query report

Hi a little while ago I posted a requested around a report to capture conversation counts per month for Support Reps a query was provided, but I can not drill down monthly. Below is what I am after:

I have a need need for a query to be produced that showed the number of conversation (in & out) that a support report has done during a month period. I current have a query that shows the below and the attached spreadsheet, but I am not able to break it down into months. The query is based on ticket created date, but I want the report based on the conversation date……e.g. the ticket may have been raised back in Dec and I need to show since then how many conversations (in & out) took place in Jan, Feb, Mar & Apr…..so I need the conversation to have a date stamp

 My Manger has asked that this report be completed by Friday this week, so I really need to get it sorted. 

 

select dep.Departmentname "Business Unit",ti.FIRST_NAME "Support Rep",wo.workorderid "Request ID", (select count(ni.notificationid) from notification ni left join notify_workorder nw on ni.notificationid=nw.notificationid where nw.workorderid=wo.workorderid and ni.Notificationtype='REQREPLY' and ni.senderid!=1) "No of replies sent out", (select count(conv.Conversationid) from conversation conv where conv.workorderid=wo.workorderid) "No of replies received",std.STATUSNAME "Request Status",cd.CATEGORYNAME "Category",scd.NAME "Sub Category",icd.NAME "Category Item",wo.TITLE "Subject",dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME/1000),'1970-01-01 00:00:00') "Created Time",dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.LASTUPDATED /1000),'1970-01-01 00:00:00') "Last Updated" from workorder wo left join workorder_threaded wot on wo.workorderid=wot.workorderid left join workorderstates wos on wos.workorderid=wo.workorderid left join statusdefinition std on std.statusid=wos.statusid LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN department dep on wo.departmentid=dep.departmentid LEFT JOIN CategoryDefinition cd ON wos.CATEGORYID=cd.CATEGORYID LEFT JOIN ItemDefinition icd ON wos.ITEMID=icd.ITEMID LEFT JOIN SubCategoryDefinition scd ON wos.SUBCATEGORYID=scd.SUBCATEGORYID where  wot.thd_woid=wot.workorderid and wo.isparent='1' AND (dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME/1000),'1970-01-01 00:00:00') >= convert(varchar,'2016-01-01 00:00',21) and dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME/1000),'1970-01-01 00:00:00') <= convert(varchar,'2017-04-06 23:59',21))

                New to ADSelfService Plus?