How do I filter to exclude a label?

Alex Bea December 17, 2012

I'm having trouble using the JQL syntax to exclude a single label from a Greenhopper board. I get errors when trying to use "labels !~ theming" and "labels != theming" returns no results (because of most returning NULL for labels, I think). "Theming" is the label I'm excluding in this example, and in real life.

What is the syntax to exclude only a single label from a board using filters?

4 answers

1 accepted

43 votes
Answer accepted
Dave
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 17, 2012

Hi Alex,

I just gave this a try with project=project AND (labels != 'test' OR labels is EMPTY) and was able to pull up all issues in my project except those with the test label. Give this a try and let us know how it goes.

Thanks,

-dave

Alex Bea December 17, 2012

Looks like that did it! I'd tried NULL rather than Empty. Thank, Dave.

Like # people like this
Felix Zimmermann July 30, 2018

From the future I would like to thank you for your awesome solution. Thanks, Dave!

Like # people like this
Seif Eldin Serag December 1, 2018

You're my hero. Thank you

Like Eric Willig likes this
Dorian Workman January 25, 2019

Worked!  Thanks.

Like Eric Willig likes this
Robert Deao March 6, 2019

Thanks for posting answer David, exactly what I was looking for!

Like Eric Willig likes this
Thomas Papougnot September 17, 2019

Thanks for the tips !

Like Eric Willig likes this
Saskia Kaaks November 11, 2019

Thanks!

Like Eric Willig likes this
Shweta Mane February 14, 2020

Really Helpful. I was exactly looking for this.

Marianne van Donselaar June 19, 2020

Thank you!! Really helpful!

gautamb August 9, 2020

But wouldnt this exclude labels that are Empty. What if I just wanted to exclude the issues having that particular label

Like kschmarr likes this
Geoffrey Kirk September 17, 2020

Perfect!  Thanks!

Tuarn McInerney June 2, 2021

Worked like a charm, Cheers

5 votes
Daniel Luevano May 29, 2015

if you want to do this with more than one label, you need to add the is EMPTY value for every label?

I have something like this:

project = "[PROJECT]" AND status in (Open, "In Progress", Reopened) AND (labels!= postponed OR labels is EMPTY) AND (labels !=testing_functionality_ignore OR labels is EMPTY)

but if you want to exclude 40 labels?

Ollie Blacklock September 9, 2016

I think this works:

project = "[PROJECT]" AND status in (Open, "In Progress", Reopened) AND (labels not in (label1,label2,...,label40) OR labels is EMPTY)

Like # people like this
Ryan Bullock September 12, 2019

Adding the first solution twice worked for me. So if my two labels I want to exclude are project and systemupgrade:

...AND (labels != project OR labels is EMPTY) AND (labels != systemupgrade OR labels is EMPTY)...

Like Seif Eldin Serag likes this
Denis Howe February 24, 2021

Ollie's solution is shorter and works for me.

1 vote
Roger December 1, 2019

I have following problem with labels, because a story can have multiple lables and I would like to filter the following

Story 1 - Label A, B, C, D

Story 2 - Label A, D

Story 3 - Label A, B, E

=> select alle story which NOT have label A or B -> expected result Story 1 and 2

if i enter "Label not in (A, B)" then none of the above stories appears as result.

Prashant Sultania
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.
March 6, 2020

Hello @Roger 

 

You can use following JQL to filter it

project = "Project name" AND issuetype = Story AND (labels != label A OR labels != label B)

This will give you the expected result.

0 votes
Denis Howe February 24, 2021

You might think that

labels not in (...)

means "labels does not include any of ...", which would obviously be true for tickets with no labels.

But actually it seems to be interpreted as "labels includes (only) items not in ...".

I guess it's consistent with "x not in (...)" where "x" is a simple value rather than a set, where it means "x has some value other than ..." but it's very unintuitive.

Suggest an answer

Log in or Sign up to answer