how do i write a jql query to search bugs created in last 2 sprints

Sanket Salvi September 14, 2021

how do i write a jql query to search bugs created in last 2 sprints

2 answers

1 accepted

1 vote
Answer accepted
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2021

Hi @Sanket Salvi 

If you sprints had a definite time interval (e.g. 2 weeks) and you know this interval, then you can write your jql using the created date variable. Something like:

project = myProject AND issuetype = bug AND (created >= sprintStartedDate and created <= sprintEndDate)

Of course the above JQL will work only if the sprints have the same time interval. If they have a different time interval, then you can simply add an OR statement with the additional time interval.

Hope that helps! 

Sanket Salvi September 14, 2021

Thanks Alex. Will try this. But I was looking for something which I dont have to change every sprint. so that then i can add a Rich filter pie chart to this jql query. 

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2021

If your business need is e.g. to find all bugs from all closed sprints, then there is a solution for you.

project = DSP AND sprint in closedsprints() order by created DESC

If your need is to find all bugs from two specific sprints then you could use as well:

project = DSP AND Sprint in (2, 3) order by created DESC

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2021

Hi @Sanket Salvi 

Yes, and...to Alex's suggestions:

When you need something specific like this (the last 2 sprints) and you do not want to change the filters manually, you have a limited number of options:

  • Investigate marketplace addon apps for JQL to see if they can dynamically detect the prior closed sprints
  • Investigate marketplace addon apps for better dashboard/reporting gadgets
  • Use automation for Jira rules to dynamically alter the filter when a sprint completes.  Please note you will need to learn about automation rules and calling the REST API to do this one.

Kind regards,
Bill

Like # people like this
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2021

Use automation for Jira rules to dynamically alter the filter when a sprint completes.  Please note you will need to learn about automation rules and calling the REST API to do this one.

Nice thought @Bill Sheboy! I wasn't aware that you could do that, and I might give it a try!

Like Bill Sheboy likes this
0 votes
Daniel Turczanski - __JQL Search Extensions
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 14, 2021

Hey @Sanket Salvi ,

I don't think it's currently possible.

You can get the results manually by getting all the bugs in the previous 2 sprint and checkng the creation time.

What do you need the results for?

Sanket Salvi September 14, 2021

I want to sort the bugs resolved in last  2 sprints  to analyze the RCA (Universal)

Suggest an answer

Log in or Sign up to answer