The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Trying to create a monthly average duration using performance analytics

david_myers
Tera Contributor

I have existing metrics that calculate duration and business duration of certain scripted conditions.   I would like performance analytics to help calculate averages and provide charts to visualized these indicators.  

For example, The metric is Release Task Lead time.   Start is defined as when the Approval field is marked 'Approved'.   End is defined as when the State changes to WIP.   The metric is already established and collecting data.   Business Duration is calculating based on a certain business schedule.  

Since the metrics already have the data I would like to use Performance Analytics.   Goal is to have the Average Business Duration of these Lead time metrics, monthly.  

i have created Automated Indicators to collect the count of any metric instance where the Value is 'Lead Time'.   I have the sum of each instance for the past 6 months.  

Now I need to collect the total duration of these instances for each month, which I will then use a formula indicator to calculate the average.  

The problem I am running into is trying to get a SUM of the Business Duration field values.   I am unsure how to gather this data.   I have setup my automated indicator but it's returning zero values.  

Can anyone give me some direction on how to accomplish my goal?  

1 ACCEPTED SOLUTION

Ok, well unless the business_duration field contains the number of miliseconds, this script is not going to work.


Out of the box the field business_duration is an duration field (datetime). To get the number of days back you first need to retrieve the fields content in miliseconds.


It will probably work if you create the script like this


var days=function(x) {


        return x.dateNumericValue()/(24*60*60*1000);


};


days(current.business_duration);


View solution in original post

6 REPLIES 6

Ok, well unless the business_duration field contains the number of miliseconds, this script is not going to work.


Out of the box the field business_duration is an duration field (datetime). To get the number of days back you first need to retrieve the fields content in miliseconds.


It will probably work if you create the script like this


var days=function(x) {


        return x.dateNumericValue()/(24*60*60*1000);


};


days(current.business_duration);


Thanks for your help, that worked!