Hi,
I am looking for some help on a SQL query in relation to SLAs for a service desk application please.
I have the query below in SQL Report Builder which pulls out the Incidents that have met the SLA level for the month of June.
The help I require is to perform a count of all the tickets for the month in question and then find the percentage of those for that month that are within their SLA. It looks like I need some form for subroutine which I have no experience of and seem to be failing with everything I have tried:
select distinctImIncidentTicket0.ProcessId as [Incident.ProcessId],
ImIncidentTicket0.SubmittedBy as [Incident.SubmittedBy],
sla1.SLAStatus as [SLA.ResolutionLateStatus],
sla1.LateDate as [SLA.ResolutionLateLateDate],
sla1.CompletedDate as [SLA.ResolutionLateCompletedDate]
FROM
ReportProcess as Process with (NOLOCK) inner join (SELECT s.ReportLogProcessID, s.[Status] SLAStatus, s.StartDate, s.LateDate, s.CompletedDate, s.PausedDate, s.PausedBy, s.PausedUntilDate
FROM
dbo.SLAProcess s WITH (NOLOCK) inner join dbo.SLAConfig c WITH (NOLOCK) on s.SLAConfigID = c.SLAConfigID
WHERE
c.SLAMilestoneID='152E9002-C700-4DCF-8A05-557B164AE37F'
AND c.SLAEscalationID<>'6914F10D-55F3-46DA-AE37-76218308A5E7') as sla1 on ((sla1.ReportLogProcessID = Process.ReportLogProcessID)) inner join ImIncidentTicket as ImIncidentTicket0 with (NOLOCK) on ((ImIncidentTicket0.ProcessId = Process.ReportProcessID))
AND DATEPART(Month, Process.ProcessStarted) = 6
AND DATEPART(Year,Process.ProcessStarted) = 2018
AND sla1.SLAStatus = 4
AND ImIncidentTicket0.SubmittedBy <> 'user@conmpany.com'
ORDER BY [Incident.ProcessId]