Percentage of issues moved from status within 30 days of entering that status?
Asked by dta:

Is there a way to extract a count or percentage that shows how many issues are moved from one status to another within 30 days of being in the first status?

I am trying to show data on the project dashboard that displays the number of issues that were moved from a certain status within 30 days of entering that status. Is it possible to do this within Jira JQL? If not, what add-ons would allow me to do this? I have tried manipulating the Time in Status add-on to show this but have been unsuccessful. If you have any thoughts on how to use the Time in Status add-on or any other features to do this, feel free to share.


Answers:
author: Matt Parks
body: I only have Jira Software (DC) and I do something similar where I track the time that a work item entered a particular status (based on an Automation rule) and then, when it leaves that status, I fire an even that triggers a script listener that calculates how long it spent in that status and flags the issue as meeting the SLA. That way, I can query on how many issues meet the SLA versus how many don't, which can be displayed on a dashboard.

The script listener/calculation portion requires that Scriptrunner (at least the way that I've implemented it), but I could share the script with you if you have Scriptrunner as well.

comments: author: dta
body: Yes, that would be fantastic I'll try out the script.


author: Matt Parks
body: The X-Team SDD Review Updated At field is set to the time when a user executes a transition that automatically sets the value of that field to the current time.  
The Architect SDD Approved At Field is set by an Automation rule when a separate field (not included here because it isn't important) has its value set to Approved. In addition to setting the time of the Architect SDD Approved At to {{now}}, the rule also publishes the event that triggers this listener.  
import com.atlassian.jira.component.ComponentAccessor  
import java.util.Date  
import com.atlassian.jira.issue.MutableIssue;  
import com.atlassian.jira.issue.index.IssueIndexingService;  
import com.atlassian.jira.event.type.EventDispatchOption;  
import com.atlassian.jira.util.ImportUtils;

def issue = event.issue as MutableIssue

def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService);  
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def xTeamSDDReviewField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("X-Team SDD Review Updated At").first()  
def archSDDApprovedField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Architect SDD Approved At").first()  
def sddApprovalTimeField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("SDD Approval Time").first()

def xTeamSDDReviewValue = issue.getCustomFieldValue(xTeamSDDReviewField) as Date  
def archSDDApprovedValue = issue.getCustomFieldValue(archSDDApprovedField) as Date

if (!xTeamSDDReviewValue \|\| !archSDDApprovedValue)  
{  
log.error("One or more fields do not have a value")  
return;  
}

def xTeamSDDReviewMillisValue = xTeamSDDReviewValue.getTime()  
def archSDDApprovedMillisValue = archSDDApprovedValue.getTime()  
def numOfHours = (archSDDApprovedMillisValue - xTeamSDDReviewMillisValue) / 3600000

numOfHours = numOfHours.round(1)

numOfHours = numOfHours as Double  
issue.setCustomFieldValue(sddApprovalTimeField, numOfHours)

ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)  
boolean wasIndexing = ImportUtils.isIndexIssues();  
ImportUtils.setIndexIssues(true);  
issueIndexingService.reIndex(ComponentAccessor.getIssueManager().getIssueObject(issue.id));  
ImportUtils.setIndexIssues(wasIndexing);


author: Matt Parks
body: I didn't include it above, but the script takes the value of those two fields, converts them to milliseconds and calculates the difference between the two, converting to hours (and rounding to the nearest tenth of an hour). Then it updates a custom number field that you can then use in a JQL.


author: Mehmet A _Bloompeak_
body: Hi [@dta](/t5/user/viewprofilepage/user-id/5507429)

To get time in status info, you can try [Status Time Reports](https://marketplace.atlassian.com/1221826) 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](http://status-time.bloompeak.io/demo), you can see it in action and try without installing the app. If you have any questions, feel free to [schedule a demo](https://bloompeak.io/schedule-a-call) with us. We will be happy to help.

For further details, you can have a look at [Status Time Reports How to Videos.](https://www.youtube.com/playlist?list=PLVHoaAkoFPJnG9nLkzcxG0P00ndQgimDs)

++App Features:++

* 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, resolution 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 completely **free** solution, you can try the limited version [Status Time Reports Free](https://marketplace.atlassian.com/apps/1222051).

Hope it helps.


author: Gizem G?k?e _OBSS_
body: Hello [@dta](/t5/user/viewprofilepage/user-id/3763076) ,

You also asked how you can do it with a time in status plugin. Let me answer that for you.

This result can be achieved with [Timepiece (formerly Time in Status)](https://marketplace.atlassian.com/apps/1211756/) app, the oldest and leading Time in Status app in Atlassian Marketplace, which is built by my team at OBSS. It is available for both Jira Cloud, and Data Center.

In the Status Duration report, you can use the [**Filter**](https://dev.obss.com.tr/confluence/display/MD/TiS+Cloud+-+Filter?utm_source=app&utm_medium=mainPage) option to filter issues by their duration in status. In the example below, I have filtered the results for issues that have been in the To Do and In Progress statuses for less than 30 days. At the top left of the report you will see the total number of issues. And the rest of the report is the list of issues that meet these filter conditions

![Filter 30 days.png](https://community.atlassian.com/t5/image/serverpage/image-id/326553i44B02AFB9B18B763/image-size/large?v=v2&px=999 "Filter 30 days.png")

If you wish, you can also [schedule a live demo.](https://calendar.app.google/faQYgsEekRdFxnPj7) We will provide a comprehensive overview of the application and address any inquiries you may have.

Hope it helps,

Gizem