Filter creation
Asked by Anthony Pitaval:

Hi all,

I'd like to create a filter through a JQL search. The goal is to sort out all tickets created by two groups of users and created between Jan 1st and Dec 31st of a year (I'd like to run it for 2022, 2023, 2024 and coming years).

My request is the following:

assignee in membersOf("Hardware R\&D France") or assignee in membersOf("Software R\&D France") AND created \> "2024/01/01"

I can get the tickets list but some from 2022 and 2023 were extracted too. How can I better define or restict the time slot and have the tickets of one year only?

Thanks for your help.

Anthony


Answers:
author: Evgenii
body: Hi, [@Anthony Pitaval](/t5/user/viewprofilepage/user-id/4829433)

You can use such filter, if you want to strictly declare year:

```
(assignee in membersOf("Hardware R&D France") or assignee in membersOf("Software R&D France")) AND (created >= "2024/01/01" AND created <= "2024/12/31")
```

Don't forget to use ( ) to group conditions. In my example i splitted conditions, that user must be in any of 2 groups, and filtered by date creation.  
Without grouping your filter will select all issues for group "Hardware R\&D France" AND all issues for "Software R\&D France" created from the 01.01,2024

If you want to select issues for current year, you can use such JQL:

```
(assignee in membersOf("Hardware R&D France") or assignee in membersOf("Software R&D France")) AND (created >= startOfYear() AND created <= endOfYear())
?
```

comments: author: Anthony Pitaval
body: Hi [@Evgenii](/t5/user/viewprofilepage/user-id/3993514) ,

Thanks for your help. Works fine.

Do you know whether it would be possible to only extract/display the month of the date.

The idea would be to have date formats like 2024-01 for months with one digit and 2024-10 for months with 2 digits.

That would help me a lot in the retreatment afterwards.

Thanks


author: Evgenii
body: Hi, [@Anthony Pitaval](/t5/user/viewprofilepage/user-id/4829433)

Not sure, that I understood the idea correctly. You want to take year and date from date field, like "Created" and save it in another custom field like "2024-09" ?  

If answer is "yes", than you can use automation rule, which will make this operations on issue creation. Take date, parse it and save to anoher field of issue.


author: Anthony Pitaval
body: You understood well.

I've never used automation rules sp far. Is there some tutorials that I could use to help me do this operation?

Thanks for your help.


author: Evgenii
body: Sure.   

About Date smart values in Jira Automation you can read here:  
<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/>

I made a small example. In It I take year and month of creation date. The I show it in log and save to summary:

![Screenshot_12.png](https://community.atlassian.com/t5/image/serverpage/image-id/349430i1D11436AE5D24552/image-size/large?v=v2&px=999 "Screenshot_12.png")![Screenshot_13.png](https://community.atlassian.com/t5/image/serverpage/image-id/349428iC0FEEFC3B820F868/image-size/large?v=v2&px=999 "Screenshot_13.png")![Screenshot_14.png](https://community.atlassian.com/t5/image/serverpage/image-id/349429i25AFA71AF06C6B3F/image-size/large?v=v2&px=999 "Screenshot_14.png")


author: Kristine Daniels
body: Try adding parentheses around your assignee clauses

(assignee in membersOf("Hardware R\&D France") or assignee in membersOf("Software R\&D France")) AND created \> "2024/01/01"


Tags: cloud

jira-cloud