Jira Smart Values: Math Expressions Examples
JIRA, an essential project management tool for agile teams, offers a powerful feature known as "smart values." These smart values allow users to encapsulate complex data and enable dynamic calculations using math expressions. Let's explore how to leverage math expressions in JIRA smart values to increase efficiency and automation in your workflows.
Smart values in JIRA enable you to calculate fields based on other fields. For instance, you can calculate the remaining work effort as the sum of remaining time estimates for all linked issues. Before we dive into examples, let's understand the basic syntax of math expressions used in JIRA smart values.
Basic Syntax of Math Expressions
Math expressions in JIRA smart values use Java's expression language. Here's a quick overview:
- Operators: +, -, *, /, %, ^ (exponent), Link children, Link parents
- Operands: Numeric values, Issue fields, Variables
- Functions:atem() - at:this() - at:parent() - at:child() - sum() - min() - max() - avg() - total()
Once you're familiar with the syntax, let's dive into real-world use cases.
Example 1: Calculating Remaining Work
Let's say you want to calculate the remaining work effort for a task. You have two custom fields: 'original time' (in hours) and 'time spent' (in hours). The remaining work can be calculated as:
"original time" - "time spent"
To set this up as a smart value:
- Go to Project settings > Fields > Custom fields.
- Edit the target field (e.g., 'remaining work').
- In the 'Calculation formula' section, enter the expression above.
- Click Update.
Example 2: Calculating Total Work for a Multi-Level Sub-task Hierarchy
Now, let's calculate the total original work for a multi-level sub-task hierarchy. Assuming you have a custom field 'original time' at each level, you can use the sum() function like this:
sum("original time", at:child())
This will sum up the 'original time' of all child issues and descendants, giving you the total original work for the entire hierarchy.
Calculating with Issue Links
JIRA smart values also allow you to perform calculations using issue links. Let's explore how to calculate the total remaining time for all linked issues.
Example 3: Calculating Total Remaining Time for Linked Issues
Let's assume you have a custom field 'remaining time' for each linked issue. You can use the Link children operator and the sum function to calculate the total remaining time:
sum("remaining time", Link children)
This expression will sum up the 'remaining time' of all issues linked to the current issue.
Example 4: Calculating Average Time Spent for Linked Issues
Now, let's calculate the average time spent on all linked issues. Assuming you have a custom field 'time spent' for each linked issue, use the avg() function like this:
avg("time spent", at:parent())
This expression will calculate the average 'time spent' of all issues linked to the parent issue.
Embracing smart values and math expressions in JIRA allows you to automate calculations, enabling you to focus on making data-driven decisions rather than performing repetitive tasks. As your team's needs evolve, experiment with different expressions to unlock new levels of efficiency and automation in your workflows.