Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column
width30%600px


Panel
borderColor#333f48
bgColor#FFFFFF
titleColor#eeeeee
borderWidth1
titleBGColor#333f48
borderStylesolid
titleOn this page

Table of Contents
maxLevel1



Column




Calculated Number Field

This type of read-only custom field has a value which is dynamically calculated from a custom math/numeric expression. It can be used to obtain a numeric value depending on the value of other fields in current issue, or in any other issues: linked issues, sub-tasks, epics, stories, JQL selected issues, etc.



Configuration

Math expression

This parameter contains a valid math expression that will be calculated each time the value of the field is required.

Example 1: Calculated Number Field "Number of Blocking Issues"

In this example we show how to create a calculated number field called "Number of Blocking Issues" that will return the number of unresolved issues current issue is linked to with "is blocked by" issue link type.

1) Create a new Calculated Number Field custom field called "Number of Blocking Issues" at Administration > Issues > Custom fields > Add Custom Field > Advanced > Calculated Number Field (by JWT)

2) Go to configuration screen of the newly created custom field:



3) Click on 'Edit Math/Numeric Expression':



4) Configure the field by entering a math/numeric expression:



5) Once configured, the configuration of the new custom field looks like this:



The math expression used in this example is: count(filterByResolution(linkedIssues("is blocked by"), "")).


Example 2: Calculated Number Field "Time to Due Date"

In this example we configure a calculated number field that will show the remaining time for Due Date:


We use the following math-time expression: {00012} != null ? max({00012} - {00057}, 0) : null, where {00012}  is code for Due date, and {00057} is code for Current date and time.

Notes:

  • Conditional operator ? : in order to avoid errors in the subtraction when Due date is not set. In this case we return null, i.e., not initialized.
  • Function max(x, y) is used to avoid returning a negative duration when Due date has passed.

We select duration as display format, since the numeric value being calculated, a number of milliseconds, represents a time duration. This way the value is represented like Time to Due Date: 2d 9h 43m instead of a single number.

We also check parameter "Uninitialized when calculated value is zero", since we don't want the field to be shown once Due Date has been reached.



Example 3: Field to show time since issue creation to resolution

In this example we configure a calculated number field for showing the time elapsed since issue creation to issue resolution. For issues which are still not resolved, the field will be uninitialized, thus it won't be shown in the view screen:




We use the following math-time expression: {00112} != null ? {00112} - {00009} : null , where {00112} is code for Date and time of resolution, and {00009} is code for Date and time of creation.

Notes:

  • Conditional operator ? : in order to avoid errors in the subtraction when Date and time of resolution is not set. In this case we return null, i.e., not initialized.

We select "Duration with short format" as display mode. This way, the string value of the field will be something easily readable, like 1d 11h 30m, but the numerical value will be the duration expressed in milliseconds.

Other display options available are:

  • Duration with long format: we get something like 1 day, 11 hours, 30 minutes.
  • Use time tracking settings: we get duration displayed using the number of working hours per day, and the number of working days per week as configured in time tracking, instead of 24 hours per day and 7 days per week.

Example 4: Currency field to show sum of values of field "Sale Amount" in all sub-tasks of current issue

In this example we configure a calculated number field, "Total Sales",  for showing the sum of values of a field "Sale Amount" in all sub-tasks of the current issue incl
  • .
a currency symbol. If no values exist, the field will be left uninitialized and will not be shown on the view screen:

The field code for Sale Amount is {10208}

Image Removed

Then we edit the display format, copying the pattern with the dollar sign. 

Image Removed

Resulting in this field configuration:

Image Removed