How to filter ONLY user stories linked to epic with a specific label?

Magdalena April 4, 2023

Hello,

 

I've created a dashboard in Jira based on rich filter like this:

project = 123 AND (Cell in (ABC, DEF, GHI, JKL, MNO, PRS, TUV) OR workstream in (ABC, DEF, GHI, JKL, MNO, PRS, TUV)) AND issuetype = in(Epic, Story) AND issue in issuesInEpics("labels in (committed_for_Q1_2023)") OR labels = committed_for_Q1_2023 OR issue in issuesInEpics("labels in (stretch_for_Q1_2023)") OR labels = stretch_for_Q1_2023 OR issue in issuesInEpics("labels in (new_for_Q1_2023)") OR labels = new_for_Q1_2023 ORDER BY issuetype ASC

Having created this, I wanted Jira to display all Epics labeled with committed_for_Q1_2023, stretch_for_Q1_2023 or new_for_Q1_2023 AND all user stories linked to these epics as well as all user stories where there's no label on epic level, but the user story is labeled independently with committed_for_Q1_2023, stretch_for_Q1_2023 or new_for_Q1_2023.

I have two rich filter controllers on my dashboard: one designed to control epics, the second to control user stories. I'd like to narrow the results down in rich filter results gadgets and display ALL user stories linked to labeled epics as well as all user stories where there's no label on epic level, but the user story is labeled independently with committed_for_Q1_2023. I use working query like that:  issuetype = Story AND labels in (committed_for_Q1_2023) and labels not in (new_for_Q1_2023)

 

Still I receive just user stories labeled, those linked to labeled epics are not displayed. I tried so many times to adjust the query and it doesn't work.

Same for: issuetype = Story and labels = stretch_for_Q1_2023 AND status != Cancelled 

Just independently labeled user stories are displayed. Those attached to epics labeled with stretch_for_Q1_2023 are omitted. 

 

Which query is superior? On dashboard level or gadget level?

I can't handle it anymore. Pls help. 

 

1 answer

0 votes
Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 2023

Hi @Magdalena welcome to the community.  You need to break up your jql into something more parametrized.  Use brackets to isolate and group.

re: Something like this.  Non-Tested


project = 123 AND ((Cell in (ABC, DEF, GHI, JKL, MNO, PRS, TUV) OR workstream in (ABC, DEF, GHI, JKL, MNO, PRS, TUV)) AND issuetype = in(Epic, Story) AND (issue in issuesInEpics("labels in (committed_for_Q1_2023)") OR labels = committed_for_Q1_2023 OR issue in issuesInEpics("labels in (stretch_for_Q1_2023)") OR labels = stretch_for_Q1_2023 OR issue in issuesInEpics("labels in (new_for_Q1_2023)") OR labels = new_for_Q1_2023)

Magdalena April 6, 2023

Nope, it doesn't work. There's an error:

Error in JQL Query: Expecting either a value, list or function but got 'in'. You must surround 'in' in quotation marks to use it as a value. (line 1, character 343)

 

And still I'd like to exclude epics, just see user stories under labeled epics, but not epics itself. 

Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2023

remove the epic issue type from your search string

Magdalena April 6, 2023

project = 123 AND (Cell in (ABC, DEF, GHI, JKL, MNO, PRS, TUV) OR workstream in (ABC, DEF, GHI, JKL, MNO, PRS, TUV)) AND issuetype = in(Epic, Story) AND issue in issuesInEpics("labels in (committed_for_Q1_2023)") OR labels = committed_for_Q1_2023 OR issue in issuesInEpics("labels in (stretch_for_Q1_2023)") OR labels = stretch_for_Q1_2023 OR issue in issuesInEpics("labels in (new_for_Q1_2023)") OR labels = new_for_Q1_2023 ORDER BY issuetype ASC

 

If you mean the one bold and underlined, even when it's removed, epics are still there. 

Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2023

Let's break this out.

First clause.
project = 123 AND (Cell in (ABC, DEF, GHI, JKL, MNO, PRS, TUV) // returns all in project 123 and any issue in Cell = ABC, DEF, GHI, JKL, MNO, TUV

Second clause. // This is an OR clause and negates the first clause
OR workstream in (ABC, DEF, GHI, JKL, MNO, PRS, TUV)) AND issuetype = in(Epic, Story) AND issue in issuesInEpics("labels in (committed_for_Q1_2023)")   // returns all in workstream = ABC, DEF, GHI, JKL, MNO, TUV and any Epics or Stories as well as issue that are in an epic and have a Label = committed_for_Q1_2023

Third clause. // This is an OR clause and negates the first and second clause
OR labels = committed_for_Q1_2023

Fourth clause. // This is an OR clause and negates the first second, and third clause
OR issue in issuesInEpics("labels in (stretch_for_Q1_2023)") 

Fifth clause. // This is an OR clause and negates the first second, third, and fourth clause
OR labels = stretch_for_Q1_2023

Sixth clause. // This is an OR clause and negates the first second, third, fourth and fifth clause
OR issue in issuesInEpics("labels in (new_for_Q1_2023)")

Seventh clause. // This is an OR clause and negates the first second, third, fourth fifth, and sixth clause
OR labels = new_for_Q1_2023

grouping the OR statements into something like below.  I tested this using my own values.  No Epics get returned.
I think the key here is the first project statement.

project = 123 and (issueType != Epic) AND (Cell in (ABC, DEF, GHI, JKL, MNO, PRS, TUV) // first clause OR (workstream in (ABC, DEF, GHI, JKL, MNO, PRS, TUV) AND issuetype = Story AND issue in issuesInEpics("labels in (committed_for_Q1_2023)")) OR (issueType != Epic AND ((labels = committed_for_Q1_2023) OR (issue in issuesInEpics("labels in (stretch_for_Q1_2023)")) OR (labels = stretch_for_Q1_2023) OR (issue in issuesInEpics("labels in (new_for_Q1_2023)")) OR (labels = new_for_Q1_2023))) // second clause ORDER BY issuetype ASC

Magdalena April 12, 2023

Error in the JQL Query: Expecting ')' before the end of the query.

 

I have message like this. I tried few configuration with '' before clause, after clause and still doesn't work. I don't know...

Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2023

Count off your open and closed ( )  make certain that the you're closing off the same number you are opening.

Suggest an answer

Log in or Sign up to answer