- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2016 11:24 AM
Hello,
I am very new to Performance Analytics and need some help. We tried creating a PA Indicator to get the sum of a duration field of a few thousand records. For some reason, the dashboard shows 0 for the sum. Is it possible to add duration fields? In the screenshot below, the highlighted item is what we want to add up.
Thanks,
Maria
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2016 10:52 PM
Hi Maria,
a duration field is actually a datetime field so you can not simply sum the values from that column but you first need to translate those values to numeric values. In Performance Analytics you can create a script (Data Collector > Scripts) that is called during score collection. For example, a script on the incident table for the field Duration (with a column name of calendar_duration, use that in the actual script) could look like:
Durations are stored as offset in milliseconds from Jan 1, 1970; hence the division by (60 * 60 * 1000) to retrieve a number in hours.
Next the script is used when defining the indicator. For example an indicator that retrieves the Average duration of resolved incidents, looks like:
The result looks like:
Hope this helps.
Cheers, Pieter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2018 08:25 PM
Hi,
From the attachment it seems you are not passing the parameter calendar_duration for the method definition, please update the code as
var hours = function(calendar_duration){
return calender_duration.dateNumericValue()/(60*60*1000);
};
hours(current.calendar_duration);
Now give a try and check.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2018 08:55 PM
no same error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2018 09:00 PM
can u completely post your code here? and also check the field column label, whether it is correctly mentioned as per table definition or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2018 09:02 PM
this is the whole code

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2018 09:02 PM
can I call u I urgently need to fix this ...my number is 9896170243