How can I limit my dashboard to only display JIRA items by Label when multiple Labels exist?

Karl Reading October 21, 2024

I have a rich filter that returns results based on Labels. I want to set my dashboard to only show the results with the specific labels that I'm interested in. I have labels A-D. My dashboard is returning those results, but if the JIRA item also has a label such as E, it's returning E as well in the dashboard. My query is only looking for labels A-D.

I tried using a Dynamic Filter based on Labels, and then select A-D in the Rich Filter Controller, but it still also returns other labels in the dashboard because they are also on the same JIRA.

My query is:

Project in ("these projects") AND issuetype = Triage AND labels = A OR labels = B OR labels = C OR labels = D AND created >= startOfWeek(-1w) ORDER BY createdDate asc, status desc

 

3 answers

0 votes
Hannes Obweger - JXL for Jira
Atlassian Partner
October 22, 2024

Hi @Karl Reading

welcome to the community!

That's a tricky one. Two things:

First, as @Mikael Sandberg said, it's important to be mindful of the precedence of logical operators (AND "stronger" than OR). I personally heavily use () for the sake of readability.

Second, if you don't want to have certain labels in your search result, you explicitly need to exclude these labels. E.g., you would want to do something like

labels IN (A, B, C, D) AND labels NOT IN (E, F, G, H, I)

This, of course, may not be practical for very large numbers of labels. In this case, I believe you'll need extra tooling, e.g. from the Atlassian Marketplace. I'll add more information below.

Hope this helps,

Best,

Hannes

Hannes Obweger - JXL for Jira
Atlassian Partner
October 22, 2024

... and to expand on my last point: Your use case would be easy to solve if you manage to apply regular expressions on your labels.

E.g., If you're open to solutions from the Atlassian Marketplace, this would be easy to do in the app that my team and I are working on, JXL for Jira.

JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you’d do in e.g. Excel or Google Sheets. It also comes with a number of advanced features, including support for (configurable) issue hierarchiesissue grouping by any issue field(s), sum-ups, or conditional formatting - as well as the ability to filter issues via regular expressions.

With regular-expression-based filtering, you can apply pretty much any logic, including the one that you are after:

labels-specific-labels-via-regex.gif

(Note how we only see issues with labels training and/or analysis, and no other labels.)

The regex that I'm using is

^(training|analysis, )*(training|analysis)$

and for your exact example, it would be

^(A|B|C|D, )*(A|B|C|D)$

Note that I don't need to list E (or F, G, H, I, etc.).

Once you've identified your issues, you can work on them directly in JXL (e.g., bulk edit them via copy/paste), or trigger various operations in Jira.

Any questions just let me know!

Like # people like this
Karl Reading October 22, 2024

Thank you for all the information. I typically prefer using "in" and () but what you see is a product of where I left off when trying to figure out why what I wanted wasn't working as I expected.

I thought about excluding labels as currently there are only a few outliers that stick out, but overall we have a ton of labels. They really shouldn't be getting applied, but I figured it would be best to write one filter to target exactly what I need and then forget about it.

We're moving to Atlassian Cloud as an org in the next few months. Maybe that will open up some opportunities for JXL.

In the meantime, it looks like writing one filter per label is going to have to suffice. The problem with that is it makes my dashboard look clunky, with too much on it, which means I'll now have to have a second dashboard just for this.

I would have thought that the Dynamic filters in the rich filter or the rich filter controller would have made it possible for exclusions such as this.

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2024

Hi @Karl Reading,

Welcome to Atlassian Community!

The way your query is currently configured it will return Triage issues in the specified projects with label A, or return any issues with label B or C or D. When you are using OR in a query it is important to also use (), otherwise the query will behave differently than what you intended. So try this:

Project in ("these projects") AND issuetype = Triage AND (labels = A OR labels = B OR labels = C OR labels = D) AND created >= startOfWeek(-1w) ORDER BY createdDate asc, status desc

Karl Reading October 22, 2024

Thanks. Yes, I usually use ( ). The query I presented is a result of not understanding why it wasn't returning what I expected in the dashboard. I understand it's going to produce A-D, which is what I want.

The problem is that on the dashboard, sometimes the JIRA item with A may also have a label of E. E is now showing on my dashboard instead of just A. So on a pie chart, E has it's own percentage. I only want to see A-D.

0 votes
bduncan
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.
October 21, 2024

I do not think the widget will support your case, if the solution is for literally four labels although not ideal you could have a filter and widget per label, and set up your dashboard to suit.

WIDGET 1 - Issues with label A

WIDGET 2 - Issues with label B

WIDGET 3 - Issues with label C

WIDGET 4 - Issues with label D

Suggest an answer

Log in or Sign up to answer