How to filter for last working day in Jira JQL
Asked Answered
T

3

13

We use Jira Agile with a "Daily Scrum" board which filters for issues due in the last day. This will show us the issues we should have fixed yesterday and the issues we will fix today. This works great, except for Mondays.

On Monday we want to see the issues that had a due date of friday or duedate of today. How can I achieve this using JQL? It seems JQL doesn't support IF(), correct?

If it does, we might find a way using a compare like now() == startOfWeek().

Truss answered 18/11, 2013 at 7:20 Comment(0)
T
16

We have a similar issue on Monday morning where we need to review issues created over the last friday and the weekend rather than just the past 24 hours. You can't test whether today is Monday, but you can infer it:

AND (
(created >= startOfDay("-3d") AND created < startOfDay("-2d") AND created >= startOfWeek("-2d") AND created < startOfWeek("-1d"))
OR
(created >= startOfDay("-2d") AND created < startOfDay("-1d") AND created >= startOfWeek("-1d") AND created < startOfWeek())
OR 
(created >= startOfDay("-1d") AND created < startOfDay() AND created >= startOfWeek() AND created < startOfWeek("+1d"))
OR
created >= -24.5h)

This basically includes things from Friday if Friday was 3 days ago, Saturday if Saturday was 2 days ago and Sunday was yesterday.

In your case you want to show where:

  • duedate is today
  • OR
  • duedate is yesterday (startOfDay("-1d")...startOfDay()) AND duedate is between Mon-Thurs (startOfWeek("+1d") .. startOfWeek("+4d"))
  • OR
  • duedate is last Friday (startOfWeek("-2d")) AND duedate is 3 days ago/today is Monday (startOfDay("-3d")...startOfDay("-2d"))

Note: This assumes the default US locale where startOfWeek() is Sunday

duedate >= startOfDay() OR
(duedate >= startOfDay("-1d") AND duedate < startOfDay() AND duedate >= startOfWeek("+1d") AND duedate < startOfWeek("+4d")) OR
(duedate >= startOfWeek("-2d") AND duedate < startOfWeek("-1d") AND duedate >= startOfDay("-3d") AND duedate < startOfDay("-2d"))
Thimbleful answered 23/2, 2015 at 16:36 Comment(2)
I thought I could do startOfWeek("+1d") > now() to infer it is Monday, but JQL doesn't support functions in the left side of an operator. :'(Finbar
Note that an AND was missing in the 3rd line of the last expression. I've fixed it.Dardan
B
0

I will loose this question until Monday. So I'm going to test next query:

createdDate >= -1d OR createdDate = endOfWeek(-1d) 
Borst answered 29/9, 2021 at 7:4 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Popular
A
-2

I'd setup a Quick Filter and use something like:

duedate = endOfWeek() OR duedate = Now() 

If you want to see things that are overdue and things that are due today ...

duedate < now() OR duedate = now()  

There is no default formatting to allow a selection of a specific day like "Friday" without installing plugins like JQLTricks.

Americanist answered 18/11, 2013 at 17:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.