‎12-07-2016 04:06 PM
‎12-28-2016 11:08 AM
Select Top 1000000 TicketsInSLA.TicketsInSLA,
TotalFiscalTickets.[Total Tickets Fiscal Year],
Cast((Cast(TicketsInSLA.TicketsInSLA As Float) /
Cast(TotalFiscalTickets.[Total Tickets Fiscal Year] As Float)) *
100 As NVARCHAR) + '%' As Percentage
From (Select Top 1000000 Count(htblticket.ticketid) As TicketsInSLA
From htblticket
Inner Join (Select Top 1000000 htblticket.ticketid As ID,
Min(htblnotes.date) As [Initial Response Date]
From htblticket
Inner Join htblnotes On htblticket.ticketid = htblnotes.ticketid
Inner Join htblagents htblagents1 On htblnotes.userid = htblagents1.userid
Where (htblnotes.date <= htblticket.slainitial And htblnotes.notetype = 1
And DatePart(mm, htblticket.date) >= 6 And DatePart(yy, htblticket.date) =
2016) Or
(DatePart(mm, htblticket.date) <= 7 And DatePart(yy, htblticket.date) =
2017)
Group By htblticket.ticketid
Order By ID) As TicketInSLACount On htblticket.ticketid =
TicketInSLACount.ID) As TicketsInSLA,
(Select Top 1000000 Count(htblticket.ticketid) As [Total Tickets Fiscal Year]
From htblticket
Where (DatePart(mm, htblticket.date) >= 6 And DatePart(yy, htblticket.date) =
2016) Or
(DatePart(mm, htblticket.date) <= 7 And DatePart(yy, htblticket.date) =
2017)) TotalFiscalTickets
Go to top
Select Top 1000000 TicketsInSLA.TicketsInSLA,
TotalFiscalTickets.[Total Tickets Fiscal Year],
Cast((Cast(TicketsInSLA.TicketsInSLA As Float) /
Cast(TotalFiscalTickets.[Total Tickets Fiscal Year] As Float)) *
100 As NVARCHAR) + '%' As Percentage
From (Select Top 1000000 Count(htblticket.ticketid) As TicketsInSLA
From htblticket
Inner Join (Select Top 1000000 htblticket.ticketid As ID
From htblticket
Inner Join htblnotes On htblticket.ticketid = htblnotes.ticketid
Inner Join htblagents htblagents1 On htblnotes.userid = htblagents1.userid
Inner Join htblticketstates On htblticketstates.ticketstateid =
htblticket.ticketstateid
Where (htblticket.updated <= htblticket.slaresolved And
DatePart(mm, htblticket.date) >= 6 And DatePart(yy, htblticket.date) =
2016 And (htblticket.slaresolved != '' Or htblticket.slaresolved
Is Not Null) And htblticketstates.statename = 'Closed') Or
(DatePart(mm, htblticket.date) <= 7 And DatePart(yy, htblticket.date) =
2017)
Group By htblticket.ticketid
Order By ID) As TicketInSLACount On htblticket.ticketid =
TicketInSLACount.ID) As TicketsInSLA,
(Select Top 1000000 Count(htblticket.ticketid) As [Total Tickets Fiscal Year]
From htblticket
Where (DatePart(mm, htblticket.date) >= 6 And DatePart(yy, htblticket.date) =
2016) Or
(DatePart(mm, htblticket.date) <= 7 And DatePart(yy, htblticket.date) =
2017)) TotalFiscalTickets
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now