I am trying to create a filter to identify issues that took more than 7 days to resolve within the past 30 days. I attempted to use the following JQL query, but it did not produce the expected results.
" resolution = Done AND timespent > -7d and created >= startOfDay("-30d") ORDER BY resolved DESC "
Could someone please assist me in identifying the correct query?
Hi @Kashif Rahman ,
You should try this JQL:
resolution = Done AND resolved >= startOfDay("-30d") AND created <= startOfDay("-7d") ORDER BY resolved DESC
Hi @Monika Rani
Thank you for your response, but it's still showing unexpected results. For example, there is a ticket that was created on 26th December and resolved on 30th December, but it is being picked up by the filter.
Let me know if you have other ideas in your mind.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kashif Rahman ,
The condition created <= startOfDay("-7d")
filters issues created more than 7 days ago. However, this doesn't guarantee that the issues took more than 7 days to resolve. To ensure the query captures issues that took more than 7 days to resolve within the last 30 days, you need a way to calculate the time between created
and resolved
. Unfortunately, Jira's native JQL cannot compute the difference between two dates.
Could you try Automation rule for that.
Set up an automation rule in Jira to tag issues that take more than 7 days to resolve. Then filter issues using that tag:
Automation rule:
{{issue.resolutionDate.diff(issue.created, "days")}} >= 7
.took_more_than_7_days
).JQL Query:
resolution = Done
AND resolved >= startOfDay("-30d")
AND labels = took_more_than_7_days
ORDER BY resolved DESC
Let me know if it will help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems you want to create a filter to identify issues resolved within the last 30 days that took more than 7 days to resolve. While the JQL query you provided points in the right direction, it seems there's some misunderstanding regarding the use of timespent
and how it calculates durations.
Unfortunately, JQL does not directly support calculating the time between statuses (e.g., "Created" to "Resolved") or resolution time durations. However, you can achieve this with add-ons. Here's how you can use them to solve your issue:
Track "Time Between Created and Resolved":
You can also set up highlights of values that exceed the permissible level, and in this case, you can receive issue and email notifications.
While Jira's native JQL lacks direct support for calculating durations like "Created to Resolved," you could adjust your query to this for basic filtering:
resolution = Done AND resolved >= startOfDay("-30d") AND created <= resolved - 7d ORDER BY resolved DESC
Explanation:
resolution = Done
: Ensures the issue is resolved.resolved >= startOfDay("-30d")
: Filters issues resolved in the last 30 days.created <= resolved - 7d
: Ensures the issue took more than 7 days from creation to resolution.However, this query only works in limited scenarios and won't give you accurate results for issues with complex workflows (e.g., reopened tickets).
Add-on developed by my by SaaSJet team.
Also you can book a demo with our specialist to see add-on in action!
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kashif Rahman ,
The JQL query you provided doesn’t yield the expected results because the timespentfield represents the total logged work time, not the actual time an issue spent between its creation and resolution. Unfortunately, Jira’s native JQL doesn’t support date arithmetic or calculations like determining the duration between two timestamps directly.
If you’re open to using a third-party app, I recommend trying Timepiece - Time in Status for Jira, developed by my team at OBSS. Timepiece can calculate the duration an issue spent between specific events, such as its creation and resolution. You can easily generate reports to filter and analyze issues resolved within a specific time range and durations exceeding 7 days.
With Timepiece, you can:
1.Create a Duration Between Statuses report to calculate the exact time between the Created event and the Resolved/Closed/Done status.
2. Apply filters to identify the resolution time exceeds 7 days.
If you'd like to explore this solution further, feel free to check out Timepiece on the Atlassian Marketplace or schedule a demo with us for a walkthrough of the app's features.
Hope it helps!
Gizem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
could you try:
resolution = Done AND resolved >= startOfDay("-30d") AND resolved - created > 7d ORDER BY resolved DESC
I guess this could do the trick, since I think timespent refers to the worklog hours, not the calendar duration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The JQL has the following error
Expecting an operator but got '-'. The valid operators are '=', '!=', <, >, <=, >=, '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 67)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.