Usually everything you do in Jira is orientated around a sprint. Your current sprint. Or perhaps even a past sprint or a future sprint. In which case you're going to come up against scenarios where you need a neat list of issues related to a sprint. In this post we look at three Jira JQL functions that you can use to help you search for issues in a particular sprint.
If you're looking to find a list of issues that are related in some way to a particular sprint then we need to delve into a few JQL functions. Fundamentally an issue can be in Future Sprints, Open Sprints and Closed Sprints.
The Backlog view will show us the Open and Future sprints (shame it can't show us the closed sprints but that's just the way it is).
Issues in Sprints
To match this JQL provides us with these three functions ..
An issue is either in an Open, Future or Closed sprint. Except it's not quite that simple. An issue, in some circumstances can exist in a closed and an open sprint. Let's talk about that confusing state in a bit though. For now…
With a JQL search You could use this standard approach…
project = "DX" and sprint = "DX Sprint 2"
Trouble with this is that means the sprint you’ve defined is hard coded. That’s not great if this is a saved filter or the basis of a dynamic report. Which is why we want to use a query with a function like this…
project = "DX" and sprint in openSprints ()
or using the project as a parameter to the function…
sprint in openSprints (DX)
Depending on how you have your instance of Jira configured (you may have Parallel sprints configure) you'll see issues from 1 or more in play Sprints.
JQL to Show Issues In Open Sprints
Similarly, if you're interested in future sprints that you're planning
sprint in futureSprints (DX)
That's all of the issues you've assigned to sprints that you haven't started yet. This won't include issues on the backlog though. That kind of goes without saying.
Lastly then, for all of our closed sprints in a project we'd use…
sprint in closedSprints (DX)
Now there is one thing to watch out for. That is that an issue can be linked with MANY sprints.
– My current sprint has all issue Done with 1 left ToDo
– I complete the sprint
– That sprint has one issues that isn't complete
– You move these to the next sprint
Closing a Jira Sprint
When you close this sprint and move the Open issues to the new sprint, then these issues will be tracked against BOTH sprints.
Jira Issues in Multiple Sprints
That's why you see an issue (i.e. Story D above) in two sprints. And this is why these issues show up in both 'closed' and 'open' sprint queries.
sprint in openSprints(DX)
sprint in closedSprints(DX)
Just remember, it's possible for an issue to belong to both a completed sprint and an incomplete sprint.
If you want to exclude the issues from the closed sprint …. that were moved to the open sprint, you can use JQL like this.
sprint in closedSprints (DX) and sprint not in openSprints(DX)
With this JQL your list shows JUST the issues that were “completed" in previous sprints.
That's about as far as you can go with the standard JQL. Covers you for most things though.