Hey Folks!
I have been searching for a way to JQL a query which will list all issues with MORE than one label added to it.
I cant find a way.
I know how to filter issues with the labels I want, for instance label = something but what if I want a list of issues that have more than 1 label. I got like 30 labels.
Any guidance is much appreciated!
Thanks!!!
I am on JIRA 8.5.4 btw
Hi @Fer ,
Welcome to the community! Using JQL you wouldn't be able to do this generically (i.e. label is x and ahs more than 1 label) . Label's is not a numerical field and the entire field is global, so if you want to do it you want have to make the filter pairs
lets say you had Label A, Label B, Label C
You would need to do a JQL for the combos
so
(labels = Label A AND labels = Label B AND labels = Label C) OR (labels = Label A AND labels = Label B) OR (labels = Label A AND labels = Label C) OR (labels = Label B AND labels = Label C) etc
Otherwise you would need to do a database search, from the database itself or via tool like scriptrunner
Oh thanks so much for your detailed response! This is great.
Well, due to the ammount of labels I got (around 30) I believe I wont be able to apply the pair solution. I will check scriptrunner! Thanks!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
3 years later and this answer is still helping. Thank you for your detailed answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the following with 4 labels, slightly shorter than the above:
project=XYZ AND (
(labels=A AND labels in (B,C,D)) OR
(labels=B AND labels in (A,C,D)) OR
(labels=C AND labels in (A,B,D)) OR
(labels=D AND labels in (A,B,C)) )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there, I tried this and it worked very well :
project = XYZ AND labels in (label1, label2, label3)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Asma,
the original question was how to find issues with more than one label, but your solution will also return issues that have just one label out of the entire list within the parantheses.
In my case for example, the labels would be for teams or departments: dept1, dept2, dept3, and I want to find all issues where more than one department is involved and show them during a cross-department meeting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am trying with multiple labels and it is not working. If I keep label=Feedback, it works but not with multiple labels. Pls help
project = ABC AND labels in (Feedback, Process Change, Engagement) AND status not in (Completed, Done, Cancelled) ORDER BY Summary ASC, updatedDate DESC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This seems to be unrelated to the original question, you want to find a single label, while the original question was to filter tickets that have more than one label. The filter should only return tickets that have two or more labels, but not tickets with just one label.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Process Change" needs the quotes, because it has whitespace.
You should build up your queries step by step, and make sure they get the green checkmark. Use Autocomplete!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use JQL/Advanced Query to filter for all cases where your field is not empty.
Then you can use the `Export` option to extract that to CSV
Once you've got a CSV you'll find that fields which can contain multiple values appear multiple times (e.g. `Labels`, or any `Custom Field (MyMultiSelect)`). The first of these columns will contain a value (you've already filtered out those which didn't have anything via the JQL). Those with more than one value will also have something in the second of these columns; whilst those with only one value will have a blank - so you can now filter values in Excel/PowerShell/whatever you use to work with CSVs - to find those with multiple values.
If you needed to go back to JQL with your findings (e.g. to use `bulk update`) you could generate a new JQL query which filters on the keys you found:
- Filter for those rows with multiple labels (or for those without, per your needs)
- Copy these to a new sheet (or else delete these rows if you're interested in the inverse) so you have a table with just the items you're interested in
- Create a new column with formula `=concat(B2,",")` (assuming B is your key column) to get the key followed by a comma. Copy this formula across all rows in your table
- In another blank cell put `=concat("key in (",concat(X:X),")")` (where X is the new column created in the previous step. This will create your JQL with all the keys you're after
- Copy/paste this value into your JQL filter.
The above's not dynamic - it'll only give you a list of keys for a static filter.
If you want something more dynamic another approach could be to use the CSV results to identify common pairs - so you can use the pairs workaround above, but instead of working out every possible combination you use the data to work out the most likely combos and then only hunt for those; giving you a dynamic filter that will catch most things.
Not a great solution, but hopefully helpful where you've got a lot of options making the "pairs" workaround above impractical.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.