Ratio of a field to another as a percentage

📚

This template displays the percentage ratio of one field to another as a progress bar.

If either field doesn’t have a value, it displays None.

For the parameters Field A and Field B, pick the two fields to relate to another, such that your desired result is to see “Field A is 70% of Field B”.

Configuration

To use this template, simply select it from the template grid. Filter by Portfolio roll-ups & delivery KPIs to find it faster.

Parameters

To complete the configuration, select values for all parameters.

image-20260610-152046.png

Edit formula mode

If you click on Edit formula you can see the formula field in the Expression Parser. You can now tweak the expression to create a custom formula field based on this template.

Expression

General expression:

let fieldA = issue?.customfield_AAAAA?.value && issue?.customfield_AAAAA?.value > 0 ? issue?.customfield_AAAAA?.value : null;
let fieldB = issue?.customfield_BBBBB?.value && issue?.customfield_BBBBB?.value > 0 ? issue?.customfield_BBBBB?.value  : null ;
(fieldA && fieldB) ? fieldA / fieldB * 100 : null ;

Display as

Progress bar

Max Range

100

Details

1. What does the expression do?

This expression calculates the percentage ratio between two specific fields (Field A and Field B) on a work item. It is designed to show what percentage Field A represents of Field B (e.g., "Field A is 70% of Field B"). If either field is empty or contains a value of zero or less, the expression returns no result ("null"), which prevents errors like dividing by zero.

2. Step-by-step breakdown

  • let fieldA = issue?.customfield_AAAAA?.value && issue?.customfield_AAAAA?.value > 0 ? issue?.customfield_AAAAA?.value : null;

    • let fieldA: This creates a temporary label (variable) called "fieldA" to store the value of your first field.

    • issue?.customfield_AAAAA?.value: This looks for the value of a specific custom field on the work item. The ? is a safe navigation operator, which ensures that if the field or the work item doesn't exist, the expression doesn't crash.

    • && ... > 0: This checks if the value exists and if it is greater than zero.

    • ? ... : null: This is a ternary operator (a shorthand "if-else" statement). It says: "If the value is valid and greater than zero, use it; otherwise, set it to null (empty)."

  • let fieldB = issue?.customfield_BBBBB?.value ...

    • This step does exactly the same as the first step, but for your second field (Field B).

  • (fieldA && fieldB) ? fieldA / fieldB * 100 : null ;

    • (fieldA && fieldB): This checks that both fields have valid numbers.

    • fieldA / fieldB * 100: This is the actual calculation. It divides the first value by the second and multiplies by 100 to get a percentage.

    • : null: If either field was empty or invalid, it returns nothing.

3. Examples

  • Scenario 1: Field A is 7 and Field B is 10.

    • Calculation: (7 / 10) * 100 = 70.

  • Scenario 2: Field A is 5 and Field B is empty.

    • Result: None (null), because both values are required for the calculation.

  • Scenario 3: Field A is 0 and Field B is 10.

    • Result: None (null), because the expression specifically looks for values greater than zero.

4. Real-life use cases

  • Budget Tracking: If Field A is "Actual Cost" and Field B is "Total Budget," this expression shows what percentage of the budget has been spent.

  • Progress Monitoring: If Field A is "Story Points Completed" and Field B is "Total Story Points," you can visualize the completion percentage of a specific work item.

  • Time Management: If Field A is "Time Spent" and Field B is "Original Estimate," it helps track how much of the estimated time has been consumed.