Versions Compared

Key

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

...

Mathematical Function

Description

Example

round(number, decimals)

Rounds the passed value to the specified number of significant decimal digits.

  • round(15.386, 2) = 15.39

  • round(15.5, 0) = 16

floor(number)

Rounds the passed value to the nearest lower integer.

  • floor(16.34) = 16

ceiling(number)

Rounds the passed value to the nearest higher integer.

  • ceiling(16.34) = 17

abs(number)

Gives the absolute value, i. e. the positive value.

  • abs(-15) = 15

  • abs(15) = 15

signum(number)

Normalises negative values to -1, zero to 0, and positive values to 1.

  • signum(-255) = -1

  • signum(0) = 0

  • signum(135) = 1

mod(dividend, divisor)

Calculates the remainder of the dividend when divided by the divisor.

  • mod(13, 2) = 1

Aggregating Function

Description

Example

sum(number…)

Sum of the passed values

  • sum(1, 4, 5) = 10

avg(number…)

Average of the passed values

  • avg(3, 5, 7) = 5

min(number…)

Smallest of the passed values

  • min(-12, 0, 346) = -12

max(number…)

Largest of the passed values

  • max(-135, 0, 1) = 1

Relation Function

Description

Example

subtasks(field)

Retrieves the values of the passed field from all subtasks.

Must be aggregated before using outside of a function.

  • avg(subtasks('Story Points'))

parent(field)

Retrieves the values of the passed field from the parent of a subtask.

  • parent('Quantity')

issuesInEpic(field)

Retrieves the values of the passed field from all issues in an epic.

Must be aggregated before using outside of a function.

  • min(issuesInEpic('Budget'))

epic(field)

Retrieves the values of the passed field from the epic of an issue.

  • epic('Price')

linkedIssues(linkName, field)

Retrieves the values of the passed field from all linked issues.

Must be aggregated before using outside of a function.

  • max(linkedIssues('causes', ‘Percentage’))

Advanced

More complex use cases

Setting a Boundary on Values

You need to ensure the value of the Calculated Field “Price” stays above 0, but is at most 20. A minimum bound can be set by using max and a maximum using min. The price is calculated using the “Net Price” field and the “VAT” field.

  1. We first need to calculate the price, which can be done using "Net Price” + VAT%

  2. Then, we want to set the upper bound of 20, so we get min(”Net Price” + VAT%, 20)

  3. At last, we need the lower bound, so we get max(min(”Net Price”) + VAT%, 20), 1)

Ensuring Entered Numbers Are Integers

You have a field requesting the “Number of Participants” on a transition screen. Your subsequent calculations require this number to be a whole number. To ensure this, you use a Calculated Field Post Function on the same transition.

  1. The post function will write to the “Number of Participants” field

  2. We want to operate on the same field, so we start with the formula “Number of Participants”

  3. Then, we want to make sure that it is a whole number. We do this by rounding, we round up in this case: ceiling(”Number of Participants”)

If the entered number is already a whole number, it is unchanged. However, if it is not, and someone enters 15.3 for example, it is rounded up to the next whole number, and we get 16.
Because we write the result to the same field during the transition, i. e. “Number of Participants”, the same field is adjusted, and we have successfully sanitised the input.

Multiple Values

The mathematical functions can also operate on the multiple values that are returned by the relation functions. That way you can for example round all the values returned by a subtask.

avg(round(subtasks('Number of Affected Systems'), 0))

The functions accept the lists in the following ways:

  • round(number_list, decimals)

  • floor(number_list)

  • ceiling(number_list)

  • abs(number_list)

  • signum(number_list)

  • mod(dividend_list, divisor)

The function then is applied separately to each element in the list, and a list with the new values is returned. The mathematical functions do not reduce the list in size, the only way to do that is to use an aggregating function.