- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 08:40 AM
If we want to measure 'Average time to Respond' from the user's perspective, we should follow a 24-hour schedule, right? (real-time).
There are a few tasks that to my understanding need to be done to achieve this:
1. First, create a new Metric to measure the time difference between incident opened - incident assigned (assigned to specifically).
Here's the script that I took from an SN Performance Analytics book (authored by SN):
if (current.assigned_to != "") {
createMetric();
}
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists()) return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
// gr.duration will calculate the time difference between incident creation and incident assigned to
gr.duration = gs.dateDiff(
gr.start.getDisplayValue(),
gr.end.getDisplayValue()
);
gr.calculation_complete = true;
gr.insert();
}
2. Once we have this in production and we are collecting data, we can use the mi_duration property of that metric to report on it, right?
So now we're left with the problem I have:
3. Create an automated Indicator to calculate the Average of all those metrics collected. This is what I did for the Automated Indicator:
What I noticed after collecting the data is that if I select Hours or Days for the Unit, that's what it will show on the Analytics Hub. Which doesn't make sense to me.
So my fear is that the Aggregate Average function on the Automated Indicator is NOT doing a real average calculation.
The Metric I created initially on step 1 above is collecting UTC strings, so:
- Do I need to convert those UTC strings to milliseconds to be able to calculate a real Average?
- Do I need to create two different automated indicators (count + sum) and then a formula indicator to achieve this?
- If so, how do I do a count and a sum when working with time? Can i sum or count milliseconds to get an average?
Solved! Go to Solution.
- Labels:
-
Performance Analytics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 12:57 AM
You need to convert to hours in order to Average Hours or days to Average Days.
In dateDiff flag TRUE returns seconds and then we calculate hours and save it to record.
start = new GlideDateTime(gr.sys_created_on);
closed = new GlideDateTime(gr.closed_at);
dur_sec = gs.dateDiff(start, closed,true)
var dur_hours = Math.round(dur_sec / 3600);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 10:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 12:53 PM
Did the data collection jobs execute successfully ? what do you see in scorecards ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 09:01 PM
If I put Hours on the Unit the scores will show 1 Hour, 2 Hours, 3 Hours for different Assignment groups.
And if I put Days well...guess what. It will show 1 Day, 2 Days, 3 Days, whatever the Average function is trying to calculate, which makes me think there's something wrong here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 11:26 PM
You need to verify what mi_duration field contain. It should contain hours not ms in order to use Hours Average later.