Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate average duration of custom field (inprogress with scriptrunner)

Delphine Pages
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 7, 2018

Hi,

I have used the scripted field from Scriptrunner to calculate the duration of the in progress status on my issues (https://scriptrunner.adaptavist.com/latest/jira/scripted-fields.html#_total_time_this_issue_has_been_in_progress) and that works fine.

Now I would like to display in a dashboard the average in progress duration but I can't figure out how to make it work. I tried issueFunction in aggregateExpression without success. None of the gadgets seem to be able to deliver the average either.

I hope someone has found the answer before me and can put me on the right track.

Thanks!

Delphine 

1 answer

1 vote
Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 21, 2018

Hello, Delphine.

I think the best option is to use ScriptRunner's REST endpoint functionality, you can create an endpoint that can be called to return the average of the in-progress duration on all tickets. That can later be used to display the information on a gadget.

You can create a simple HTML page that calls the REST endpoint and organizes the information, then you can show the page using a plugin like Custom Content for Jira that enables you to show web pages in gadgets.

To calculate the average you can check this other Community question that shows how you can get a list of issues from a JQL. With that, you can get the value of the custom field, calculate the average, then make it available in the REST endpoint.

This is a bit complicated, a lot of different steps, but I believe it should do the job. 

Kind regards,
Maurício Karas

Suggest an answer

Log in or Sign up to answer