Forums

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

Automation: Averaging numeric custom fields

Lloyd Jones June 11, 2020

I'm trying to schedule an automation that runs a JQL query to return a number of issues, work out the Average value of a numeric custom field use this value later in the automation. 

My challenge is in actually working out the average in some way within the automation. 

I have tried the LookUp issues action but this only allows certain fields within result set to be accessed, not custom fields. I have seen that there are now ".avg" functions on numeric fields within sub tasks but the items I am collecting are not sub tasks.

Has anyone tried/done similar?

 

Thanks

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2020

Hi @Lloyd Jones 

I hope math functions are added for the lists/iterators soon!  Until then, you can solve this by breaking down the problem into pieces, and using rules for the pieces: find the sum, find the count, and compute the average.

  1. Create a rule that is scheduled, and accumulate the total of the custom field and the count of items in two new custom fields. Be sure to clear them before the loop starts.  At the end, set a new condition to trigger another rule, such as a special comment with a datetime stamp.
  2. Create a second rule that watches for the new trigger (e.g. special comment, matched by a mask). Ensure its option is set to allow it to be called by another rule. Calculate the average by dividing the total by the count.

If you do not want to wait for the schedule, you could change rule 1 to trigger when the source custom field that you want to average is changed.

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events