Script for minutes in each month

robertmueller
Giga Contributor

Hello

 

Is it possible to have a formula that will auto calculate the minutes in each month. I have a formila indicator which needs to be:

Minutes per month - Outage down time

I have an indicator to calculate the outage down time per month but how can you script it to confirm the minutes per month. ie

June would be "43200 - Outage down time", but July would be "44640 - Outage down time" as June has 30 days and July has 31.

1 ACCEPTED SOLUTION

Adam Stout
ServiceNow Employee
ServiceNow Employee

Try using a formula for this:

{{Number of open incidents}}
score_end.getDaysInMonth() * 1440

View solution in original post

6 REPLIES 6

Adam Stout
ServiceNow Employee
ServiceNow Employee

Try using a formula for this:

{{Number of open incidents}}
score_end.getDaysInMonth() * 1440

Great thank you that works. Script is now:

 

if ([[Indicator / By month SUM +]] > 0) {(score_end.getDaysInMonth() * 1440)/[[Indicator / By month SUM +]]} else { (score_end.getDaysInMonth() * 1440) }

 

This is a very basic way of doing MTBF based on the simple calculation of

 

Total up time / number of outages

 

Be aware though ITIL standard states a more complext calculation which is harder to implement especially when you want to use break downs. The calculation is:

 

The sum amount of the time between the end of the previous outage and the start of the new outage. This total is then devided by the total number of outages to get the MTBF