Need help using startOfWeek in an issue query

Brittanie July 12, 2021

Hello!

I'm trying to filter tickets created over our weekend, so my team can bulk close them. They tend to be less actionable, and the issue pops up during the M-Th work week.

I've tried the following variations of the created field. 

"created = startOfWeek(5d) OR created = startOfWeek(6d) OR created = startOfWeek(7d)"

"createdDate >= startofWeek(5d)"

"(createdDate >= startOfWeek(5d) OR createdDate <=7d)"

They do not return any data, despite tickets created during that time being available.

Any ideas as to what I've completely borked here?

2 answers

0 votes
Benjamin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 12, 2021

@Brittanie 

 

It will depend when day is the start of your week and what day is the end.

Try something like below:

created >= startOfWeek(1d) and created <= startOfWeek(5d)

 

and play with the ranges so that it fits your work week.

0 votes
C_ Derek Fields
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.
July 12, 2021

You want to use StartOfDay(-2) for a report that runs on Monday and returns tickets that were created in the last two days.

The number in StartofWeek is the number of weeks forward or backward from the current week. So StartOfWeek(-1) is the start of last week. StartOfWeek(1) is the start of next week. 

There isn't any way (that I know of) to specify "last Saturday" or "last Sunday". The startofX() is relative to the current date.

C_ Derek Fields
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.
July 12, 2021

I went back and realized that "duh" of course you can use startofWeek(-1d) to specify the previous day.

Your JQL is failing because you are calling for "=" rather that >= or <=. Keep in mind that the created date is a date/time field, so = would have to be exactly the same date/time.

You probably want 

created >= startOfWeek(-2d) AND created < startOfWeek(). This will show you the tickets created last weekend. Using a positive number looks forward. So startOfWeek(5d) is Thursday at midnight (assuming that the week start is Sunday).

Suggest an answer

Log in or Sign up to answer