How can I find an issue that is in multiple sprints?

Luke Galardi May 12, 2017

I am searching for a means, preferably jql, to find all issues in a project that are in more than one sprint.  Whether open sprints, closed sprints or future sprints - if there is more than one sprint associated with the issue I'd like to query to find it.

 

Maybe this is beyond the scope of jql and there is a plug-in to find it or I will need to write sql to do so.

 

 

5 answers

8 votes
Leo Shklovskii August 6, 2019

Assuming your sprints are incrementing in a sort (ie. Sprint 5, Sprint 6, etc... although this may work just based on Sprint ID rather than sprint name (I'm not sure how JIRA sorts)) you can do something like this:

status != Done AND sprint in closedSprints() AND sprint in openSprints() ORDER BY Sprint ASC

Make sure the sprint column is showing and you'll see the tickets that have been dragging the longest at the top of the results (because they belong to the oldest sprint).

4 votes
Andrew Newbury July 27, 2022

A colleague at our organisation came up with this simple yet elegant board filter

issueFunction in previousSprint(<board number>) AND sprint in openSprints()
eg. where 17703 in this instance is my board IDspillover.png
Why? We've exceeded the preset parameter for the total number of closed sprints in our instance to allow closedSprints() to return a value, raising that could have a potentially significant performance hit with a "badly" written JQL.
Jared Dohrman {ANZ} July 27, 2022

Noting that this requires ScriptRunner and assumes you're running the server/data centre version of Jira.

Like # people like this
Kunal Kumar September 13, 2023

This will only give the list of stories which were moved to a next sprint after spilling over and will exclude the ones which were moved to Backlog. A better JQL would be : 


issueFunction in previousSprint(<board number>) AND status =! Closed 
0 votes
Charles Fisher August 22, 2017

So - I have the same question, and here's a 'poor man's' way to get to the information. In my case I wanted to see all issues closed in the previous release and then determine how many of those issues took more than one sprint to close. 

I created a query that met the criteria (in the last release, closed) and also included the Sprint column in the results. The Sprint colu,mn includes all sprints that each issue was in, separated by commas.

I exported the results to Excel. 

In my case I just wanted to count the sprints per issue, so in Excel, I split the Sprint column into separate columns by the comma delimiter.

Then I was able to filter on the split sprint columns to see how many issues took 2 sprints, 3 sprints, etc. 

Tedious, but not as tedious as counting by hand.

0 votes
AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2017
select distinct count(cv.issue), p.pkey, ji.issuenum
from customfieldvalue cv
inner join customfield cf on cf.id = cv.customfield and cf.customfieldtypekey='com.pyxis.greenhopper.jira:gh-sprint' 
inner join jiraissue ji on ji.id = cv.issue
inner join project p on p.id = ji.project 
group by cv.issue, p.pkey, ji.issuenum
having count(cv.issue) > 1

This should give you a start - it ran on my instance and reported as expected.

Luke Galardi May 15, 2017

Hi Ann, Thank You!  I will give it a shot now.  

Ajay Mishra March 5, 2019

where do you write these SQL? The way we write JQL for filters doesn't accept this sql, is that right? 

Like # people like this
Guy LaRochelle March 29, 2022

Same here, how to you use this SQL if you're not an admin of the Jira instance?

0 votes
AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2017
Luke Galardi May 15, 2017

Close, but it does not show issues that are in 2 or sprints that are  closed sprints.

 

I have an issue, for example, that is in 4 closed sprints.  I cant quite figure out how to make it show using jql.  Maybe this require a sql query???

Luke Galardi May 15, 2017

Thank You, Ann!

Suggest an answer

Log in or Sign up to answer