JQL to find status at a point in a timeline

Imagine I have two tickets, 123 and 456 and I am working in sprint 1.  At the end of sprint 1, 123 gets a status of done but 456 failed testing and must carry over into sprint 2.  If I do a query at this time for anything in sprint 1 that was done, I'd only get 123.  Now, sprint 2 is over and 456 is done...remember it was active for 2 sprints.  If I query now for anything in sprint 1 with a status of done, I get both 123 AND 456 because the history of how long a ticket has been active is retained...so, technically it's tru...456 EXISTED in sprint 1, but achieved a Done status in sprint 2.  So what I really want to query for is any ticket that achieved it's status, whatever status I might want IN a given sprint...or something similar.  I do this for reporting to my bosses on what has been completed every sprint and if you go backward in time, reporting starts to get skewed.

I know I'm doing something "wrong"...I just don't know if it is a bad process, data points not being used that might help out with this...but we have tickets that, unfortunately, can end up crossing mutliple sprints and its creating havoc with historical reporting.

Can any one offer up some advice?

2 answers

2 votes
Thomas Schlegel Community Champion Jun 06, 2017

Hi Mike,

you need to know the start and end date of your sprint, then you can use the following jql:

sprint = <sprintname> and status changed to "<your status>" during (<start date of sprint>, <end date of spring>) 

Enter sprint dates in format "yyyy/mm/dd".



Perfect...did not know about during nor status changed....should probably read a book.  Thank you.

0 vote
Tarun Sapra Community Champion Jun 06, 2017

I have faced a similar issue, I wanted to know the "Sprint" of an issue in which it was "done" . So I use the "scripted field" funtionality of the "script runner" plugin and the following script would give you the sprint in whcih the issues was actually closed

ArrayList sprintList = (ArrayList)getCustomFieldValue("Sprint")
int numSprints = (sprintList != null) ? sprintList.size() : 0;
return (numSprints > 0) ? sprintList.get(numSprints - 1).getName() : ""

This looks like an amazing answer but more advanced than I can deal with right now...just getting to know JQL and need simpler solution so I'm not as easily confounded...but thank you for this suggestion...as a developer I find it very appealing and interesting...just not quite enough time on the learning curve right now.

Suggest an answer

Log in or Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

372 views 6 16
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot