Find all stories in specific statuses that are children of epics in specific statuses
Asked by Dylan Willis:

Jira Cloud

I need to be able to find stories in specific statuses that are linked to epics in specific statuses in a specific project

I'd like the following to actually work in cloud:

Project = XXX and linkedissue('project = xxx and issuetype = epic and status in (1, 2, 3)) and issuetype = story and status in (4,5,6)


Answers:
author: Hannes Obweger - JXL for Jira
body: Hi [@Dylan Willis](/t5/user/viewprofilepage/user-id/5187862)

welcome to the community!

Unfortunately, this is trickier than one might think; as a "hierarchical query", it would really require some kind of "join" or "subquery", which isn't available in plain Jira/JQL.  

A few directions forward:

* If it's a one-off thing, you could first query the relevant epics, and then use the keys of these epics in a second query, in an ""Epic link" in (KEY-1, KEY-2, ...)" clause.

If you want to run your search "dynamically", without manually "stitching" two queries together, you'll need extra tooling:

* You might be able to use [Jira Automation](https://www.atlassian.com/software/jira/features/automation) to "propagate" epic information down to the epic's children, and then use the respective field(s) on the children to include them into your filter. Obviously, this will add a fair bit of complexity to your system.
* There's different apps from the [Atlassian Marketplace](https://marketplace.atlassian.com/) that can help with that. First, there's a number of apps that [extend JQL](https://marketplace.atlassian.com/search?query=jql) by additional functions, including hierarchy-related functions. I've used JQL Search Extensions a few times and it works well.
* Alternatively, you could try one of the more [hierarchy-focused](https://marketplace.atlassian.com/search?query=hierarchy) apps from the Marketplace. These apps typically have their own ways of figuring out parent/child relationships between issues, and provide more powerful ways of searching through issue hierarchies. I myself work on such an app, in which your use case would be easy to solve - I'll provide more details below.

Hope this helps,

Best,

Hannes

comments: author: Hannes Obweger - JXL for Jira
body: Just to expand on the last point, this is how this would look in the app that my team and I are working on, [JXL for Jira](https://marketplace.atlassian.com/apps/1224710?hosting=cloud&tab=overview&utm_source=atlassian-community&utm_medium=referral&utm_content=2321237). Put simply, you create a sheet with all issues that could be potentially relevant, enable the default issue hierarchy (that's just one click), and then hide all issues that aren't part of the given hierarchy (that's another one click):

![epics-with-children-from-different-project.gif](https://community.atlassian.com/t5/image/serverpage/image-id/249855i9C3F110F95BEAFCD/image-size/large?v=v2&px=999 "epics-with-children-from-different-project.gif")

Once you have your list of issues, you can work on these directly in JXL (much like you'd do in e.g. Excel or Google Sheets), trigger various operations in Jira, or export them for further processing.

Any questions just let me know!


author: mauricio.groth
body: **Hi [@Dylan Willis](/t5/user/viewprofilepage/user-id/5187862)**

I'm Maur?cio, a support engineer at Appfire and I'm here to help you.

Unfortunately, using JQL of Jira, you'll not be able to do it.

In the app where my team works, [JQL Search Extensions for Jira](https://marketplace.atlassian.com/apps/1214791/jql-search-extensions-for-jira-reports?hosting=cloud&tab=overview&utm_source=atlassiancommunity&utm_medium=listinglink&utm_campaign=mauricio), you can use this query to find all your stories in specific statuses that are linked with epics from project X and other specific statuses.

```
issue in linkedIssuesOfQuery("type = epic and project = x and status in (1, 2, 3)") and issuetype = story and status in (4,5,6)
```

Please contact our [support](https://jqlsearchextensions.atlassian.net/servicedesk/customer/portal/2) if you have any other questions about this query.

We'll be happy to help you!  
Best regards,  
Maur?cio


author: Madhu_RVS
body: Hi [@Dylan Willis](/t5/user/viewprofilepage/user-id/5187862)

Welcome to the community !!

Not sure if this can be achieved by out of the box JQL.

I believe you will need a third party app which enhances JQL functionality or you can also try out hierarchy focused apps to meet this requirement.

We have built an app for the same use case.

[Issue Hierarchy Reports](https://marketplace.atlassian.com/apps/1228019/issue-hierarchy-reports?hosting=cloud&tab=overview)

Try it out and meet functionalities such as:

- Sum up values to see overall progress for your Issue Hierarchy

- View the full hierarchy of linked issues, Portfolio/Advanced Roadmaps, Epics, and Subtasks

- Apply filters to put the focus on the relevant data only

- Excel like editing for all the values right on the report and see real time progress updates

- JQL filter for child issues

- Export to a CSV file

- Embedded Epic Hierarchy on Issue Screen

- Dashboard Gadgets

Disclaimer : I am part of the team which developed this app

![Links HIerarchy - Summary Report.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/249786i04C95815E63C8F8D/image-dimensions/383x158?v=v2 "Links HIerarchy - Summary Report.PNG")![Links Hierarchy Initiative Child Filter- Summary Report.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/249787iD5009C44327501E9/image-dimensions/381x156?v=v2 "Links Hierarchy Initiative Child Filter- Summary Report.PNG")


Tags: cloud