How to filter by labels?

Krzysztof Achinger
Contributor
March 8, 2022

I am stuck again trying to add a filter based on labels. It must have sth. to do with the fact that Labels is an array data type. When trying to add a text based or dropdown based control I get empty preview table.

Screen Shot 2022-03-08 at 12.46.07.png

1 answer

1 accepted

0 votes
Answer accepted
Matthew Lempitsky
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2022

When creating your {LABELS_DROPDOWN}, a good approach would be to ensure you're creating a dropdown with all of the potential labels.

To create a dropdown control of all the labels you can simply select the "Labels" column from the Jira Issue table and then use the "Explode" aggregation. You will then need a "Group & Aggregate" step to remove any duplicate labels:
labels_dropdown.png

You can then change your Control Settings so that you can select and filter on multiple labels:

Test.png

However, there does appear to be an issue with the Empty state setting; if there are no labels selected, no results are returning, so a minimum of one label will need to be selected in the control.  

You can connect your newly created dropdown control to your chart using the same method you used in your screenshot:

How_to_filter_by_labels_.png


 

Krzysztof Achinger
Contributor
March 9, 2022

@math 

This is quite helpful and as a matter of fact I have done all those steps but it did not solve the problem. Preview table still returns 0 rows. I think I managed to narrow down the issue to the fact that I am also using History table. For results where history is not involved adding filter based on exploded labels work.

So my entire Visual query looks like this (not working)

Screen Shot 2022-03-09 at 12.01.41.png

 

When I remove Jira Issue History to String = Closed, and Status = Closed it starts working. I need those fields as I want to operate on Closed tickets only for this data visualization.

Screen Shot 2022-03-09 at 12.29.12.png

 

EDIT: I am now thinking that I might need to implement additional query and join tables before doing filtering. Will update here if that resolves the case.

EDIT 2: Confirmed, I had to build the table from two queries with Inner Join and only then results could be properly filtered by labels.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events