The single line JQL field is not really a user friendly area to write long queries. Unfortunately, Jira does not provide a corner anchor on the JQL field to make it larger so we'll need a workaround. Click in the JQL field, hold down the shift key, and hit enter a few times. That one line JQL field is now much bigger. The bad part is that it will shrink to its original size once you search, but we can it back with a simple CTRL-A.
Now that I have enough remove to work, I like breaking my query down into familiar code format. For example, if I am looking for any unplanned issues that have been worked in the last 30 days, my query might look like something like:
statusCategory IN (Done, "In Progress") AND
updated >= -30d AND
labels IN (unplanned, emergency)
Whoa! That just gave me a lot of data for all the unplanned work across all projects. I need to narrow that down just a bit. Before I tinker with the query, I will save that filter as "unplanned issues in last 30 days".
I was really just interested in issues that my team work on. Depending on how your company organizes their teams and projects, your staff might work on be found on multiple project boards. It might not be as simple as filtering on project or team name. I have managed teams that were all over the place so I usually create and save a simple query like the following:
assignee IN (Frodo, Samwise, Peregrin, Meriadoc Brandybuc)
I will save that one as "issues assigned to devops". It is now really easy to get the intersection of these two filters with the following:
filter = "unplanned issues in last 30 days" AND
filter = "issues assigned to devops"
I can easily pivot so see what work they are doing on noncritical projects. My JQL would look like:
filter = "issues assigned to devops" AND
project != "our critical project" AND sprint NOT IN openSprints()
Creating modular JQL snippets has saved me a lot of time. This method allows me to create a bunch of reusable JQL snippets that I can combine to produce various reports and dashboards. I have even used them in Jira automations. I share them out with the entire organization, and other teams can use them to their advantage. Just remember to give the filter a clear name and add a description of what is returned.