Custom field that calculates average value in a ticket for the needs of customer feedback.

Tihomir Nikolov _Nemetschek Bulgaria_
Contributor
June 27, 2024

We had a requirement form a customer to create a way to collect user's feedback on tasks from multiple participants in a ticket.

The built-in surveys have some restrictions- they work only for Jira service management and do not support more than one value.

All the addons that were researched didn't have the needed features - especially using more than one user hit per ticket.

So, we were more or less alone :)

There was an idea to use the automations for calculating the average value of a select list field.

Here is the how we achieved this:

Two custom fields are needed:

  • Average rating (number field)
  • Rating (select list with values 1-10)custom fields.PNG

The idea is that if there is a value change of the field "rating", the average rating is calculated using the formula (<average rating>+<rating>)/2. In the end there is an option for clearing the value of the rating field.

This lets the automation to update the ticket every time someone enters a value for the rating, using this formula:

{{#=}}({{issue.customfield_10232}}+{{singleRating}})/2{{/}}

automation 2.PNG

There are also a check if the average field is empty , the fist entry> In this case,  the value is just copied.

automation 3.PNG

 

The whole automation looks like this: 

automation1.PNG

 

 

1 answer

1 vote
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 27, 2024

Hi @Tihomir Nikolov _Nemetschek Bulgaria_ 

I believe that solution approach will inaccurately average over time.

For example, let's assume the ratings were 1, 2, and 2.  Using the rule shown the averages over time would be:

  • rating is 1, and new average is 1
  • rating is 2, and new average is (1 + 2) / 2 = 1.5
  • rating is 2, and new average is (1.5 + 2) / 2 = 1.75

But if the ratings were gathered and averaged, the result would be (1 + 2 + 2) / 3 = 1.667

Two alternative approaches could be:

  1. accumulate the total ratings and rating count in custom fields, and always divide those values to create the average
  2. save each rating in a list (e.g., in a comma-separated values text field such as 1,2,2) and the rating count, and recompute the values from there:
{{#=}} ( {{issue.ratingList.split(",").join(" + ")}} ) / {{issue.ratingCount}} {{/}}

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events