- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2021 11:53 PM
Hi,
Can someone advise the script needed in Performance Analytics to calculate the duration between two fields. For example I would like to calculate the duration between when the incident was opened and when it was assigned to someone.
Thank you in advance.
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 09:53 AM
For time to assignment metrics, I prefer leveraging an SLA since this will allow me to easily calculate business time in addition to absolute time. Reporting on SLAs is then pretty straight-forward.
If you don't go down this path, you need a Performance Analytics script to perform this calculation per row. This cannot be done in a Formula since they operate on aggregates.
There should be examples available OOTB based on resolved time. Just be sure to handle unassigned tasks as well (with score_start) or exclude them from your indicator. This is the primary use case for Performance Analytics scripts and can also be found in the docs: https://docs.servicenow.com/csh?version=latest&topicname=pa-scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 01:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 01:10 AM
I appreciate your effort but what you are advising is not accurate nor does it answer the question I have posted, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 02:27 AM
Hi Robert,
Kumar's advice is broadly correct, ie: to use a Metric to calculate the duration. The example he has provided illustrates the a time differential between Creation to Resolution - so, the cumulative time between two different incident States.
You can apply this discreet measurement any such state, so in your case you'd want to calculate the duration between Created / Opened and (I would presume) 'In Progress', where it can be indirectly implied the incident has been assigned.
If you do develop a Metric (as above) I would recommend testing its behaviour to see whether it produces the records you want; a risk may be that a Duration is calculated each time the Incident is reassigned or, that you'd have many instance records for each incident.
Thanks,
DJL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 02:53 AM
I am already aware of the metric value duration field, (although the one Kumar mentions is not in our system) but again this is not what I am asking for. I am looking at calculating the difference between two time stamps. So using the example I gave in more details, I need to calculate the difference between the time stamp of when the ticket is created and the time stamp of when the ticket is assigned to someone. This is supposed to be a formula but I do not know what the formula is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 03:42 AM
Hi Robert,
Both Kumar and I have described the approach to achieve your requirement. However, I can see there is clearly a knowledge gap here and therefore I would recommend you familiarise yourself with the Performance Analytics material. That will help you to better comprehend and implement the creation and/or use of Metrics.
Thanks,
DJL