Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,474
Community Members
 
Community Events
165
Community Groups

function in jql for previous sprint

Hi Team,

Need to get a function in JIRA for getting the last closed sprint which should be OpenSprint()-1, can you share the details for this.

 

Don't want to use script runner or any other plugin for this 

4 answers

1 accepted

1 vote
Answer accepted
Jack Brickey Community Leader Aug 23, 2021

Hi @Sameer Bansal , unfortunately there while there is a closed sprints function there isn’t a “previousSprint” function. Obviously you can find previous sprint details in Reports. Is there some specific goal you are aiming for?

@Jack Brickey Actually i have created a dashboard wherein we want to compare the current sprint and previous sprint for management reporting. Right now it's a pain to change the previous sprint number everytime and if someone miss to update that then complete report doesn't make any sense 

Jack Brickey Community Leader Aug 23, 2021

That is what I thought you might be attempting. Actually did you try this…

Sprint in openSprints(-1)

I don’t currently have any open sprints to verify this but a quick test says it might work.

@Jack Brickey  - yes, openSprints(-1) doesnt do anything just shows open sprint adding -1 or anything in the brackets doesn't seem to work. maybe its a bug or i don't know

Jack Brickey Community Leader Aug 23, 2021

Yes that was my understanding as well. I just haven’t tested in a long time and was hoping that maybe the feature had been added but apparently not.

Like SB likes this

@Jack Brickey  - so , what do you suggest it this a feature that we can expect in coming releases?

Jack Brickey Community Leader Aug 23, 2021

I really couldn’t say. You might check on Jira.atlassian.com and see if there is already a suggestion (likely I suspect) and vote/watch.

you might consider some other work around using dates like this…

sprint not in opensprints() and resolutiondate <= startofweek() and resolutiondate > startofweek(-2w)

of course the accuracy of such a solution is short lived and you need to adjust the date parameters to align with your sprint cadence. It also nay captures issue resolved in the pas sprint.

@Jack Brickey - thanks, is there any function from which I can get the sprint start date?

Jack Brickey Community Leader Aug 23, 2021

This is not currently possible. Here is an open suggestion - JRACLOUD-72007 

Like Andy Heinzer likes this

I am done, I am seriously considering leaving Jira now. I thought microsoft was bad, this is beyond bad. Simple and common sense features do not exist in Jira. I am just sick of it. 

0 votes

I was able to achieve previous sprint using the following:

 

fixVersion in unreleasedVersions() and project = [YOUR_PROJECT_NAME] and fixVersion in releaseDate("after now() before 30d")

Hi @Daniel Martin -- Welcome to the Atlassian Community!

I do not see the releaseDate() in out-of-the-box JQL functions.  Are you using a marketplace addon to provide that feature?

Kind regards,
Bill

0 votes
Curt Holley Community Leader Jun 01, 2022

Further to @Bill Sheboy suggestions, if you are happy to receive whatever info it is you are after via email (from an automation rule), I've just got this working to report on the mentioned issue types in the JQL for the sprint that triggered the rule to run, by using the {{sprint.id}} smart value in the JQL.

Screenshot 2022-06-02 124549.png

Hi @Sameer Bansal 

Yes, and...to what Jack notes: there is nothing built-in to do this yet.

As a work-around, you could use the built-in automation rule features to help in a few ways:

  1. Use an automation rule which automatically updates your dashboard filter (using the REST API) when a sprint completes, shifting the filter to use the new "previous" sprint id
  2. Or, add custom fields and devise a mechanism where you can distinguish the current and previous sprint, and set the custom fields with an automation rule.  Your filters could then remain stable to support reporting/dashboards

Best regards,
Bill

@Bill Sheboy  - 

1) for REST API an not sure what will be the trigger point for the automation rule 

2)  for option 2 the requirement is to distinguish the current and previous sprint

  • i am checking if i can device a formula where i can subtract the name of sprint by 1
    • example Current sprint name is "ABC  2" so somehow i can do "ABC 2-"1" " or something like that 

For option 1, you could trigger the rule on sprint completed.

it didnt worked, so i discarded the idea will check in future if reqired

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you