Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JQL filter search previous week and current week (Jira Cloud)

Raoul Kaiser
Contributor
January 25, 2023 edited

I am struggling to find the right JQL to write for a filter. I need a filter that gives me anything open, no matter when it was created, and anything that was closed last week or this week.

  • If I run the report today (Wed Jan 25) I want to see issues created Jan 15th through today 25. 
  • If I run the report tomorrow it will be Jan 15 through the 26th
  • If I run the report on the 30th it will be Jan 22 through the 30th
  • If I run the report on Feb 3rd it will be Jann 22 through the 3rd.

I only want one query that I will never update. Any suggestions?

This is what I have and it appears to work but just not sure so wanted to verify.: 

project = xxxx AND issuetype in standardIssueTypes() AND status in (xxxx) AND created >= startOfWeek(-1w) ORDER BY created ASC, status DESC

 

1 answer

1 accepted

0 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 25, 2023

The query that you have is correct, it will give you all issues in the specified project, that are in the specified statuses and was created on or after start of last week. You can actually remove the w since that is implied by the function. Note that start of week is Sunday, and end of week is Saturday.

Raoul Kaiser
Contributor
January 25, 2023

Sorry, I was told I understood the query wrong so I updated the question. I need anything open, no matter when it was created, and anything that was closed last week or this week.

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 25, 2023

Okay in that case you would have to use OR in you query, something like this:

project = xxx AND (status = open OR (status = closed AND resolutiondate >= startOfWeek(-1)))

This query will search project xxx for all issues that are open OR issues that are in the closed status and had the resolution set since last week until today.

You could remove status = closed if you have more than one terminal status that sets the resolution.

Raoul Kaiser
Contributor
January 26, 2023

Thank you for your help. I believe this will get me where I need to go.

Like • Mikael Sandberg likes this

Suggest an answer

Log in or Sign up to answer