How to exclude weekends and if possible holidays from Automated indicator and formula indicator?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2019 12:06 PM
We have created Automated Indicators "Incidents opened on today", "Incidents opened on this week", "Incidents opened on this month" and "Incidents opened on this quarter"
And using above indicators we have created formula indicators "[[Incidents opened on today / By week AVG +]]", "[[Incidents opened on this week / By month AVG +]]", "[[Incident opened on this month / By quarter AVG +]]" and "[[Incident opened on this quarter / By year AVG +]]"
Now we want to exclude weekends and if possible holidays
so please help us with same
- Labels:
-
Dashboard
-
Performance Analytics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2019 01:31 AM
You can exclude this part by passing sys id of schedule it will exclude holidays and weekends whichever you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2019 10:05 AM
Hi Akshata,
We are having automated indicator "incident opened on this month" in which indicator source having condition "opened on this month" so on automated indicator we have selected aggregate = sum and used above script but it is not working
Also in our indicator we are using only opened field in condition but in script you used resolved field
so for example if we are using condition "opened on this month" then we just want to exclude weekends with holidays from month
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2019 04:49 AM
Hi Akshata,
I too am very interested in calculating more precise averages which are adjusted to account for 'non working time', so to speak. Instead of Incident, my Use Case focuses more on analysing RITM duration and currently I am using a script to calculate the difference between Opened and Closed. But obviously this is a dumb calculation and does not reflect true work time.
I replicated your script (modifying to pass the sys ID of the schedule) however the collection job completely errored-out 😞 For reference, my current scripting - which works, returning a value in Days, is:
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(24*60*60*1000);};
hours(current.opened_at, current.closed_at);
This script points to Requested Item [sc_req_item] and Opened and Closed fields.
Ideally, I would like to carry out the same duration calculation however pass sys_ID of the 8-5:30 schedule record, to adjust accordingly. My replication of your script was:
/*var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(24*60*60*1000);};
hours(current.opened_at, current.closed_at);*/
var businessDuration = function(open,closed){
var startDate = new GlideDateTime(open);
var endDate = new GlideDateTime(closed);
var schedule = new GlideDateTime();
schedule.load('3D61b84a0cdbd9cb00497ff3651d9619b7');
var duration = schedule.duration(startDate, endDate);
duration = (duration.getNumericValue()/24*60*60*1000);
return duration;
};
Any idea on where am I going wrong?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 08:58 PM
Hi DJL,
Is this resolved for you as i am still facing issue?
In my case, We are having automated indicator "incident opened on this month" in which indicator source having condition "opened on this month" so on automated indicator we have selected aggregate = sum and used above script but it is not working and collection job showing error
Also in our indicator we are using only opened field in condition but in script you used resolved field
so for example if we are using condition "opened on this month" then we just want to exclude weekends with holidays from month.