How long in status

Lisa Stewart February 23, 2023

I am trying to figure out how long a ticket has been in a certain status. I am sure it is something simple that I am missing..

Here is what I have so far:

 

project = XXXX ssuetype in standardIssueTypes() AND status in (Open, "In Progress", "On Hold", Intake, New, "HLE Estimate", "HLE Proposed", "HLE Approved", "DLE Estimate", "DLE Proposed", "DLE Approved", "DLE Reviewed", "HLE Reviewed") AND created >= 2021-01-01 AND created <= 2023-02-28 ORDER BY created DESC

 

Can anyone help me find the time in the current status?

 

6 answers

2 votes
Lisa Stewart June 13, 2023

I found something that worked. Hopefully this will help someone else.

 

project = XXXXX AND (status changed to "A_Estimate" before -30d AND status changed to "A Estimate" AFTER -60d AND status = "A Estimate") OR (status changed to "B Estimate" before -30d AND status changed to "B Estimate" AFTER -60d AND status = "B Estimate")

1 vote
Korsten Bezuidenhout May 30, 2023

HI @Lisa Stewart ,

 

here is the code concept:

WITH CTE_BASE
as
(
SELECT
p.pname,
p.pkey,
i.issuenum,
cg.ID,
cg.issueid,
au.lower_user_name,
cg.AUTHOR,
cg.CREATED,
ci.FIELDTYPE,
ci.FIELD,
ci.OLDVALUE,
ci.OLDSTRING,
ci.NEWVALUE,
ci.NEWSTRING,
ROW_NUMBER() over (
partition by  p.pkey, i.issuenum
order by cg.created asc
) as sequence_flow
FROM changegroup cg inner join jiraissue i on cg.issueid = i.id inner join project p on i.project = p.id inner join changeitem ci on ci.groupid = cg.id AND ci.FIELDTYPE='jira' AND ci.FIELD='status' inner join app_user au on cg.author = au.user_key WHERE cg.issueid=(select id from jiraissue where issuenum = 115 and project in (select id from project where pname = 'Project name')) order by 1,3,4
)
SELECT
t1.*,
CAST(DATEDIFF(SECOND, t2.created, t1.created) / 86400 as varchar(10)) + ' days ' +
CAST((DATEDIFF(SECOND, t2.created, t1.created) % 86400) / 3600 AS VARCHAR(10)) + ' hours ' +
CAST(((DATEDIFF(SECOND, t2.created, t1.created) % 86400) % 3600) / 60 AS VARCHAR(10)) + ' minutes ' +
CAST(((DATEDIFF(SECOND, t2.created, t1.created) % 86400) % 3600) % 60 AS VARCHAR(10)) + ' seconds' as Durantion_in_STATUS
FROM CTE_BASE t1
left JOIN CTE_BASE t2 ON (t1.sequence_flow = (t2.sequence_flow + 1) and t1.pkey = t2.pkey and t1.issuenum = t2.issuenum)
order by 2,3,8 asc

 Hope this helps.

Just change the issue number in the where clause in CTE_BASE as well as the project name in the where clause

1 vote
Aljoscha Zöller April 7, 2023

You can query the database with the following SQL statement to find out for how long the issues has been in the current status:

SELECT
NOW() - cg.created "time_in_status"
FROM
jiraissue i
JOIN project p ON p.id = i.project
JOIN changegroup cg ON cg.issueid = i.id
JOIN changeitem ci ON ci.groupid = cg.id AND ci.field = 'status'
WHERE
p.pkey = 'ABC'
AND i.issuenum = 123
ORDER BY cg.created DESC
LIMIT 1

Replace ABC with your project key and 123 with the issuenumber. 

0 votes
Rahul_RVS_Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 23, 2023

Hi @Lisa Stewart 

As mentioned by everyone, an app will help solve this use case.

If you would be interested in the same, you can try out our plugin,

Agile Tools : Epic Tree, Links Tree, Time in Status & Worklogs

The add-on provides the time in each status. There are multiple other reports which help in tracking the complete life cycle of the issues.

Disclaimer : I work for RVS, the vendor for this app.

TIS.PNG

Lisa Stewart February 23, 2023

Rahul_RVS_Support

 

Thanks but I can't use Marketplace.

0 votes
Emre Toptancı _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 23, 2023

Hello @Lisa Stewart

Jira does not have an out-of-the-box report that shows individual status times. If you are interested in overall resolution times, Issue Age Report or Control Chart (of Kanban Boards) might be useful up to a degree. It is worth noting that these options offer limited details and limited flexibility.

In fact, the raw data needed to create such a report is available in the History tab of each issue but it is hard to turn these into a ready-to-use report.

For a ready-to-use report, the use of a marketplace app is needed.

 

If you are OK with using a marketplace app for this, our team at OBSS built Time in Status for this exact need. It is available for Jira Server, Cloud, and Data Center.  

Time in Status mainly allows you to see how much time each issue spent on each status and on each assignee.

tisCloud_StatusDuration_LeadTime_with Estimates.png  tisCloud_AssigneeDuration.png     

The app has Consolidated Columns feature. This feature allows you to combine the duration for multiple statuses into a single column and exclude unwanted ones. It is the most flexible way to get any measurement you might want. Measurements like Issue Age, Cycle Time, Lead Time, Resolution Time etc.

For all numeric report types, you can calculate averages and sums of those durations grouped by the issue fields you select. For example total in-progress time per customer (organization) or average resolution time per sprint, week, month, issuetype, request type, etc. The ability to group by parts of dates (year, month, week, day, hour) or sprints is particularly useful here since it allows you to compare different time periods or see the trend.

tisCloud_StatusDuration_LeadTime_Average_TimeGrouped.png

The app calculates its reports using already existing Jira issue histories so when you install the app, you don't need to add anything to your issue workflows and you can get reports on your past issues as well. It supports both Company Managed and Team Managed projects.

Time in Status reports can be accessed through its own reporting page, dashboard gadgets, and issue view screen tabs. All these options can provide both calculated data tables and charts.

And the app has a REST API so you can get the reports from Jira UI or via REST.

Gadget_AverageStatusDurationByComponent.png  tisCloud_StatusDuration_LeadTime_Chart.png

Using Time in Status you can:

  • See how much time each issue spent on each status, assignee, user group and also see dates of status transitions.
  • Calculate averages and sums of those durations grouped by issue fields you select. (For example, see average InProgress time per project and per issue type.)
  • Export your data as XLS, XLSX, or CSV.
  • Access data via REST API. (for integrations)
  • Visualize data with various chart types.
  • See Time in Status reports on Jira Dashboard gadgets

https://marketplace.atlassian.com/apps/1211756/

EmreT

0 votes
Mehmet A _Bloompeak_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 23, 2023

Hi @Lisa Stewart

If you prefer to use a marketplace app, you can try Status Time Reports app developed by our team. It mainly provides reports and gadgets based on how much time passed in each status.

Here is the online demo link, you can see it in action and try without installing the app.

  • This app has a dynamic status grouping feature so that you can generate various valuable reports as time in status, time in assignee, status entry dates and status counts, cycle time and lead time, average/sum reports by any field(e.g. average in progress time by project, average cycle time by issue creation month).
  • You can search issues by Project, Issue Type, Status, Assignee, Issue Creation/Resolution Date(and any other Date field) and JQL Query.
  • Status durations are calculated according to the working calendar you define. Once you enter your working calendar into the app, it takes your working schedule into account too. That is, "In Progress" time of an issue opened on Friday at 5 PM and closed on Monday at 9 AM, will be a few hours rather than 3 days.
  • You can set different duration formats.
  • You can export reports in CSV file format and open them in MS Excel.
  • You can also add this app as a gadget to your Jira dashboards and reach “Status Time” from Issue Detail page.
  • You can enable/disable access to Status Time reports&gadgets and Issue Detail page per project, users, groups or project role.

If you are looking for a free solution, you can try the limited version Status Time Free.

Hope it helps.

Lisa Stewart February 23, 2023

Thanks but I can't use Marketplace.

Suggest an answer

Log in or Sign up to answer