Timepiece - Time in Status for Jira

How to Predict Due Dates Using Historical Status Duration Data

Business Need

You need an automated process that uses historical Timepiece data from previously completed work items in the project to estimate the work needed for a new work item and set a realistic due date.

Solution

“STATUS DURATION” report type of Timepiece, combined with Jira Automation, can be used for this purpose.

Step 1: Configure and Save the Timepiece Report

First, create a Timepiece report...

  • Open the Timepiece reporting page.

  • Select the project in which the support issues reside (Let’s presume you have selected the ABC project).

    • Any filter selection at this point works. The selection made at this stage is not critical, as it will be overridden later during the automation configuration.

  • Switch to the “STATUS DURATION” report type.

  • (Optional) Select your business calendar if you have one.

  • Create a consolidated column and add all statuses included in the development process to this column.

A Timepiece report view highlighting the Statuses dropdown configuration menu
  • Configure the Report Options as shown below.

    • Set the "Show report as" option to "Average of value across issues" to calculate the team's mean velocity.

    • Leave the 'Group issues by' field blank. Leaving this field empty ensures that a single average is calculated for all the records selected by the user.

A Timepiece report view highlighting the Average of Total dropdown options menu, configuring the report to show average values across issues with non-empty values only
  • Go to settings and save it via "Save report parameters".

    • The parameter set name should be like “Target Due Date Report”

    • Make sure you select the "Share with everyone" option so others can use the param set as well.

Step 2: Create a Jira Automation & Set General Flow Details

Navigate to Jira Automation and start a new rule.
Before configuring the automation logic, you must define the administrative settings in the Flow Details section.

Step 3: Define Trigger and Conditions

Use the “Work item created” trigger to start the automation whenever a new work item is created. Since our goal is to analyze how long issues take to be completed in this project and add this information as a comment on the ticket, we initiate the automation at this specific event.

A Set Average Development Duration to Due Date automation builder window configuring a Work item created trigger that runs the flow whenever a new work item is created

Step 4: Add Action - Timepiece: Run Report

After defining the trigger and conditions, add a “Timepiece: Run Report” action that will fetch the required data from Timepiece.

A Set Average Development Duration to Due Date automation builder window showing Add a step configuration menu offering Action Condition Branch or Controls options
A Set Average Development Duration to Due Date automation interface showing an Add an action configuration window with Timepiece Run Report selected as the action
  • Select the report you created for this automation in the Report Settings field. Ensure that the report has been previously saved using the “Save Report Parameters” option.

A Set Average Development Duration to Due Date automation interface showing the Timepiece Run Report action settings with Parameter Overrides JSON field
  • You can adjust the JQL here according to the records you want to use for calculating the average duration.

Parameter Overrides

Override some report parameters with a custom JSON. We’ll override the report filter so it returns data only from historical work items in the same project, excluding the issue that triggered the automation.

Parameter Overrides:

{
"filterType": "customjql",
"customJql": "key != {{issue.key}} and project = \"{{project.name}}\" and type = {{issue.issueType.name}} and updated >= startOfMonth()",
"viewFormat": "Hours"
}

Step 5: Add Log Action (Optional)

Add a Log Action to your flow. This step is necessary if you want to monitor the automation and helps debug in the event of an error.
This action writes the entire dataset returned from the report as a log output, allowing you to see all available data at once.

Log Message: resultList: {{fetchedTimepieceResultList}}

A Set Average Development Duration to Due Date automation interface configuring a Log action step to add the fetchedTimepieceResultList smart value directly to the audit log

Step 6: Create Variable

In this step, we extract the average duration of the “In Development” status from the dataset and assign it to the InDevelopmentDuration variable so it can be used in later actions. (The result dataset is already expected to include only one row so we can use the first one)

Variable Name: InDevelopmentDuration
Smart Value: {{fetchedTimepieceResultList.first().get("InDevelopment").asNumber}}

A Set Average Development Duration to Due Date automation interface configuring a Create variable action to store a specific metric calculation as InDevelopmentDuration

Step 7: Create Variable

In this step, the duration stored in the inDevelopmentDuration variable is used to calculate a new due date.

Variable Name: newDueDate
Smart Value: {{now.plusBusinessHours(InDevelopmentDuration.asNumber)}}

A Set Average Development Duration to Due Date automation interface configuring a second Create variable action to calculate and store the newDueDate value

Step 8: Add Log Action (Optional)

Add a Log Action to your flow. This step is useful for monitoring the calculated due date and helps with debugging in case of unexpected results in the estimation logic.

Log Message: newDueDate: {{newDueDate}}

A Set Average Development Duration to Due Date automation interface configuring a second Log action step to record the calculated newDueDate value in the audit log

Note: For more details about the logging and debugging, see the documentation.

Step 9: Edit Work Item Fields

In the Edit work item fields step, we directly update the Due Date field using the data collected in previous steps. The Due Date field is updated with {{newDueDate}}, the recalculated date value computed in an earlier variable step.

A Set Average Development Duration to Due Date automation interface configuring an Edit work item action to dynamically assign the calculated newDueDate variable to the Due date field

Step 10: Add Comment to Work Item (Optional)

In this step, the automation adds a comment directly to the work item summarizing the calculation results. Using the data retrieved from the Timepiece report and the calculated variables, the comment shows the average resolution time for similar work items and the newly calculated target due date, providing clear visibility into the result for that specific work item.

The automation adds the following comment:

In the last month, in the "{{project.name}}" project, work items of type {{issue.issueType.name}} have been resolved within {{InDevelopmentDuration.asNumber().round()}} hours. They are targeted to be completed on {{now.plusBusinessHours(InDevelopmentDuration.asNumber).fullDate()}}

A Set Average Development Duration to Due Date automation interface configuring a Comment on work item action

Step 11: Enable the Rule

Click the “Turn on rule” button to activate the automation.

Once enabled, the automation will automatically add a comment to new work items, retrieving the average resolution time from the Time in Status app based on previously completed work items in the project and providing visibility into the expected completion duration.

A Jira work item view showing an automated comment applied to the activity section and the updated Due date field reflecting the calculated completion date