- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:04 AM
Hello All,
How to Calculate time between case(HR Case) creation and case assignation to agent?
I want Average amount of time between case creation and case assignment.
How to calculate this time?
Please Help!!
Thank You!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 09:53 PM
Hi,
It seems that you are asking me to provide a solution to a task or assignment. The given formula is used to calculate the time difference between two dates, in this case, the difference between the "opened_at" and "assigned_to" fields in ServiceNow.
To add a formula field to a report, follow these steps:
Navigate to the report that you want to add the formula field to.
Click the "Edit" button to enter report editing mode.
Click the "Add Field" button to add a new field to the report.
In the "Field Type" dropdown, select "Formula".
Give the field a name, such as "Time to Assign".
In the "Formula" field, enter the following script:
gs.dateDiff(gs.dateFromFormat(current.opened_at, 'yyyy-MM-dd HH:mm:ss'), gs.dateFromFormat(current.assigned_to, 'yyyy-MM-dd HH:mm:ss'), true)
Click "Save" to save the field and exit report editing mode.
Once you have added the formula field, it should display the time difference between the "opened_at" and "assigned_to" fields in the report.
Thanks,
Rahul kumar
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:09 AM
You can think of defining your own metric definition for this.
May be of type 'Field value duration' where you can check the time between state = new to state = assigned Or something similar on HR case to see time duration between these 2 events.
More details:
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:11 AM
and once you have metric definition then you can create report on that metric definition and see what ever you want like average etc..
Regards,Sushant Malsure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:09 AM
Hi @Pallavi pawar ,
To calculate the time between case creation and case assignment in ServiceNow, you can use a script or create a report with the following steps:
Create a new report: Navigate to the "Reports" module and create a new report. Select the "HR Cases" table as the source table.
Add columns: Add the "Opened at" and "Assigned to" fields to your report.
Add a formula field: Add a new field to your report and select "Formula" as the field type. Name the field "Time to Assign" or similar. In the formula editor, enter the following script:
gs.dateDiff(gs.dateFromFormat(current.opened_at, 'yyyy-MM-dd HH:mm:ss'), gs.dateFromFormat(current.assigned_to, 'yyyy-MM-dd HH:mm:ss'), true)
This script will calculate the time difference between the "Opened at" and "Assigned to" fields in hours.
Set filter conditions: Set filter conditions to only include cases that have been assigned to an agent. You can use the condition "Assigned to is not empty".
Group and summarize: Group your report by "Opened at" and summarize the "Time to Assign" field using the average function.
Run the report: Run the report to see the average time between case creation and case assignment.
This report will give you the average amount of time between case creation and case assignment for HR cases in ServiceNow.
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 02:13 AM
Thanks Rahul for reply,
But not getting 3rd step-
i.e. Add a formula field: Add a new field to your report and select "Formula" as the field type. Name the field "Time to Assign" or similar. In the formula editor, enter the following script:
gs.dateDiff(gs.dateFromFormat(current.opened_at, 'yyyy-MM-dd HH:mm:ss'), gs.dateFromFormat(current.assigned_to, 'yyyy-MM-dd HH:mm:ss'), true)