→ 🚀Are you a Lansweeper Champion?! Join our Contributor Program Sign up here!

Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tholmes
Engaged Sweeper III
My SQL is not upto scratch, and I found this code, but would like it to just run for this current month.
Here is the code and

Select Top 1000000 htblteams.teamname As team,
totalTickets.totalCount As [All Closed Tickets],
onTimeTickets.onTimeCount As [All Closed on Time],
Convert(DECIMAL(16,2),((onTimeTickets.onTimeCount * 1.0) /
(totalTickets.totalCount * 1.0))) * 100 As Percentage
From htblteams
Inner Join (Select htblticketteam.teamid As teamIdAll,
Count(htblticket.ticketid) As totalCount
From htblticket
Inner Join htblticketteam On htblticketteam.ticketid =
htblticket.ticketid
Where htblticket.slaresolved Is Not Null And htblticket.ticketstateid = 1
Group By htblticketteam.teamid) As totalTickets On
totalTickets.teamIdAll = htblteams.teamid
Inner Join (Select htblticketteam.teamid As teamIdOnTime,
Sum((Case
When lastCloseDate.mdate < htblticket.slaresolved Then 0
When lastCloseDate.mdate = '1900-01-01 00:01:00.000' Then 1
Else 1
End)) As onTimeCount
From htblticket
Inner Join (Select Max(htblhistory.date) As mdate,
htblhistory.ticketid As mticket
From htblhistory
Where htblhistory.ticketstateid = 1
Group By htblhistory.ticketid) As lastCloseDate On
lastCloseDate.mticket = htblticket.ticketid
Inner Join htblticketteam On htblticketteam.ticketid =
htblticket.ticketid
Where htblticket.slaresolved Is Not Null
Group By htblticketteam.teamid) As onTimeTickets On
onTimeTickets.teamIdOnTime = htblteams.teamid

here is where I got it from.

https://www.lansweeper.com/forum/yaf_postst14413_Report-for-a-percentage-of-calls-closed-within-SLA.aspx#post49564
0 REPLIES 0

Reports & Analytics

Ask about reports you're interested in and share reports you've created. Subscribe to receive daily updates of reports shared in the Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now