JQL excluding label while keeping empty label issues in filter query

Nathan Charpentier November 6, 2019

Hi, 

I'm trying to exclude a label and found a solution, except that it excludes empty labels. 

Does anyone know of a way to exclude one label from a query while keeping all other issues not in that label or empty? 

 

2 answers

1 accepted

12 votes
Answer accepted
Ilya Turov
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.
November 6, 2019

(labels != yourLabel or labels is EMPTY)

consider just first part of this JQL as looking for issues with any label besides this specific, that's strange logic, but thats the only one I can find to explain this bahaviour

Nathan Charpentier November 8, 2019

Hi Ilya, 

Thank you for your answer. 

I actually tried this option already and my problem is that most of my issues have an empty labels. I'm trying to exclude one label but include all issues with an empty label field or other labels. 

With this option all issues with an empty label are excluded by default...

Like # people like this
Ilya Turov
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.
November 8, 2019

you either exclude issues with empty labels, or include them

there's no middle ground

you can limit amount of issues by applying additional constraints, like specifying project, or issuetype, or something else

Nathan Charpentier November 8, 2019

Ok, I guessed it wouldn't be possible to find a middle ground. 
I'll try a workout by adding a label to all my issues with empty label and that should do the trick. 

Thanks !

Pamela Keogh January 28, 2022

So it seems that anything after OR in a filter resets the filter so you'll just need to add the Project name in again. For example. That's done the trick for me! 

labels != YourLabelName OR Project = ProjectName AND Labels is EMPTY

Like # people like this
Roeland van Houten May 18, 2022

Thanks! I almost went mad.

Like Pamela Keogh likes this
Juuso Ikonen March 6, 2023

@Pamela Keogh You can work around this by putting the labels part into parentheses. For instance:

Project = YourProject AND (labels != YourLabel OR labels is EMPTY)

This way the information before the OR is remembered.

Like # people like this
Pamela Keogh March 25, 2024

Nice! thanks @Juuso Ikonen !

Like Juuso Ikonen likes this
11 votes
Livia November 5, 2021

I managed to work out a solution to exclude one (or more labels) but include all issues with an empty label or other label - you can put them in brackets:

e.g. project = TT AND (labels is EMPTY OR labels not in (label-one, label-two))

This shows all tickets except for anything labelled as 'label-one' or 'label-two'

Anna Poppe December 20, 2021

Thanks so much! This is just was I was looking for :)

Like # people like this
Richard Herrada January 14, 2022

This worked for me, thank you!

Like Livia likes this
Amna Imtiaz March 7, 2022

Thanks Livia. This has helped me too :)

Like Livia likes this
Kat Murphy April 4, 2022

This was just what I needed too! thank you! 

Like Livia likes this
Celine BEUCHET May 25, 2022

Thanks Livia too :)

Like Livia likes this
Roxanne Mae Sumaya June 14, 2022

It works for me too. Thank you!

Like Livia likes this
Meghann Wright September 9, 2022

this worked for me as well! Thank you!

Like Livia likes this
Alexei Chechin November 8, 2022

Thank you! This worked well. Much appreciated.

Like Livia likes this

Suggest an answer

Log in or Sign up to answer