Sum Total Estimates and Worklogs in Project to Calculate Percent Complete

Scenario

  • "Our Jira project is a time-boxed initiative, and we'd like to track overall completion progress in terms of hours spent vs estimated"

We'll show you how to do all of this using Power Scripts™ for Jira -  a powerful scripting tool to help automate your Jira.

What This Script Does

  • Whenever an issue within the project is created, edited, or a worklog is generated, this script runs. 
  • It sums all the estimated hours on all issues in the project, sums all the logged work hours on all issues in the project, calculates the project percentage complete (in terms of hours), and then adds a human-readable comment to a "master tracker" issue with the latest data. 
  • e.g. "This project has *200h* estimated work with *120h* spent for a total of *80h* remaining. It is *60%* complete."
  • It can easily be modified to populate custom fields instead of generating a comment. This has now been reflected in the example script.

Prerequisites

  1. You have Jira Core, Software, or Service Desk installed
  2. You have Power Scripts™ for Jira installed
  3. You have created four custom fields of type "interval" and mapped those custom field IDs to the following aliases in the sil.aliases file:
    1. projectTotalTimeEstimated

    2. projectTotalWorkLogged

    3. projectTotalTimeRemaining

    4. projectPercentComplete

Modifications Required

  1. Modify the script to reference a single project to calculate totals
  2. Modify the script to reference a single issue to append comments to

Configuration

Trigger this script on the following system events:

  • Issue Created
  • Issue Edited
  • Work Logged on Issue

Script

See also