Write Script to Calculate Time to Resolve/Closed - MTTR (Task Table)

Eddie5
Tera Contributor

Hi All,

I am trying to create a report on task table (Inc & SC Task only) for MTTR. We need to calculate time duration from opened to resolved for Incident and Opened to Closed for Sc_Tasks.
Can we write a script on task table to compare these two values and get summed duration on indicators for MTTR metric?

I am aware we have OOO reports on incident table and we have customized it for sc_task table however this time we want this on task table (task) so need help how to script this?

Below is script used OOO

var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened_at, current.closed_at);

We have reached till here and unable to modify script to get comapre values to get duration. 

 

find_real_file.png

11 REPLIES 11

Mark Manders
Mega Patron

You could use the metrics table for this. It's already in place (probably just need to create some new ones so you have it for the correct table (do know that the values used on task table can cause different calculations since state is a tricky one to report on on task level).

If my answer helped you in any way, please then mark it as helpful.

Mark


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Community Alums
Not applicable

Hi Eddie,

I have a similar requirement to calculate MTTR, can you please share the steps you did for the report creation, your help is much appreciated.

 

Hi Kamleshwar, we have calculated both on different tables. for incident calculated in incident table and for tasks, calculated on sc_task table using OOB script 

Community Alums
Not applicable

I need to add  'vendor' as a breakdown and it extends from the assignment group.
each vendor has its own schedule and if I use this OOTB scrip it will calculate only from opened and resolved duration and will not consider the assignment group schedule, in this case how to add the schedule part of this calculation , can you guys help me.

Having to use schedules based on vendor I think you will be best of (mis)using the SLA Definition-table for this. Start on 'opened', stop on 'closed/resolved' and use the schedules. That will make the easiest way to report.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark