JQL Query to Find Issues Resolved On or Before Due Date

I'm being asked to come up with a method to determine the number of issues that were resolved on or before their due date during a certain period of time.

The best I can come up is this:

project = TEST AND issuetype in standardIssueTypes() AND (resolved >= 2014-02-02 AND resolved <= 2014-02-08) AND (dueDate >= 2014-02-02 AND dueDate <= 2014-02-08)

If I have 42 issues resolved between those dates, it's showing me 9 issues that were due AND resolved during that same range; however, when manually looking through the data, I actually have only 6 issues that truly have a resolved date on or before the due date within the original 42 issues. The query seems to be showing me any ticket that was resolved in the same week it was due rather than resolved ON OR BEFORE it was due.

What kind of JQL query can I do to get the results I need?

2 answers

1 accepted

Accepted Answer
2 votes

Hello Ryan,

what are you really trying to do in your query is to compare resolution and dueDate saying that resolution <= dueDate and unfortunately JIRA does not support this comparison out of the box.

https://jira.atlassian.com/browse/JRA-20727

You could try to use Script Runner plugin Scripted JQL Functions https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions#ScriptedJQLFunctions-dateCompare(Subquery,datecomparisonexpression)

You will be able to perform queries like:

issueFunction in dateCompare("", "resolutionDate &lt; dueDate +1w")

Marco

It turns out we already had Script Runner set up so I'm using that query, minus the +1w part, and it works perfectly for me. Thanks for the suggestion.

This worked for me as well, but I also wanted to emphasize the use of the sub-query section is critical for performance.  It is mentioned briefly in the Scripted JQL Doc...

project = Test and assignee = bob and issueFunction in dateCompare("""resolutionDate > dueDate")

VS

issueFunction in dateCompare("project = Test and assignee = bob", "resolutionDate > dueDate")

Building a dateCompare in to a Smart Filter (Rich filters) I had to add the whole base query into it, to prevent it from timing out.  

Hi Ryan,

Can i suggest :

https://marketplace.atlassian.com/plugins/pt.lt.lfcribeiro.jira.jqlLTFunctions

Thers a function "ExecuteQuery()" that lets you run a SQL statement.

Regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

70 views 0 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you