How do I count the parents that have a subtask

Hi, how do I create a count of parent tasks that have a subtask (and exclude the ones that don't have some tasks) i.e.

 

Count the number of tasks in this project that have any subtasks (at least 1)

Simply, count/tell me the parents that have children

Don't count the childless parents

 

Thanks

 

4 answers

0 votes
Stephen_Lugton
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2025

Hi @Karen FitzGerald _ICT Programme Delivery_ 

You've said that you want to know how many offices need a PC.  Do the subtasks have the phrase 'PC' or similar either in the summary or description

If so you could create a filter using the following JQL:

summary ~ "PC"

or

Description ~ "PC"

This would give you a count of issues with PC in the summary or descsription

You can also apply further logic to make sure only open subtasks in your project appear:

summary ~ "PC" AND Project = "Offices" AND statuscategory != Done AND issuetype = sub-task

You could then use this filter in a dashboard.

0 votes
Pasam Venkateshwarrao
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.
February 21, 2025

Hi @Karen FitzGerald _ICT Programme Delivery_ 

 

Thanks for reaching out to the community,To create a count of parent tasks that have at least one subtask in JiraCloud, you can use a JQL query within the "Automation" feature, leveraging the "subtasks" operator to identify parent issues with associated subtasks and then use a count function to get the total number of such parent issues

Create a new rule:
Trigger: Choose a trigger based on when you want the count to update (e.g., "Issue updated", "Issue created").
Condition: Use the following JQL query in the condition section

issueType in ("Story", "Task") AND project = "YourProjectName" AND issuetype != "Subtask" AND subtasks.size > 0


Action                                                       

Create a custom field: Add a custom number field to your issues where the count will be stored.         

Update issue: Use a "smart value" to populate the custom field with the count of matching issues.                                                                                 

Smart Value: {issue.subtasks.size}

 

 

Thanks

Hi Pasam, thank you. Looks like I can use this in a smart filter? I'll give it a try.

Pasam Venkateshwarrao
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.
February 21, 2025

@Karen FitzGerald _ICT Programme Delivery_ Thanks can you try and let me know if it works for you

Marc - Devoteam
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.
February 21, 2025

Hi @Karen FitzGerald _ICT Programme Delivery_ and @Pasam Venkateshwarrao 

This will provide the number of sub-tasks counted on each issue.

This will not solve the issue to count the number of tasks which. have no sub-tasks as total.

Then you would need another automation that runs manually or scheduled an in that rule do a lookup for issues where the custom number field has value 0

Then have another custom number field in the system that stores this information as that will be the total of issues with no subtasks,

This field can be found by JQL.

This field can be update by the smart value {{lookupIssues.count}

0 votes
Marc - Devoteam
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.
February 21, 2025

HI @Karen FitzGerald _ICT Programme Delivery_ 

You could create an automation rule, that triggers manually or on a schedule.

Use a lookup issues action to find all tasks and then make a log action or edit a number field.

Both need to have set {{lookupIssues.count}} as smart value in the action.

The main issue is that JQL can't perform this search ootb, you will need a marketplace app for this

 

Hi Marc, 

I want to do it in a Smart Filter on a dashboard

So I have 100 offices (parent task) and I want to know how many of them need a PC (subtask) - not all the office do.

So I have a list of PCs that were uploaded and attached to the office number.

I want to COUNT Number of Offices that need a PC i.e count the parents that have a subtask uploaded for them

0 votes
Vishal Biyani
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.
February 21, 2025

@Karen FitzGerald _ICT Programme Delivery_ 

Can you share more context as to what business problem you are trying to solve?

How will the automation be triggered?

if it is going to be scheduled, then it has a limit (i think 100) beyond which it can't fetch the issues

Epic can have child issues (like Story/Task etc). Are you only interested in standard issue types other than Epic?

Once the count is found, where should that be saved (in a custom field or somewhere else)?

Hi Vishal, I want to do it in a Smart Filter on a dashboard

So I have 100 offices (parent task) and I want to know how many of them need a PC (subtask) - not all the office do.

So I have a list of PCs that were uploaded and attached to the office number.

I want to COUNT Number of Offices that need a PC i.e count the parents that have a subtask uploaded for them

Vishal Biyani
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.
February 21, 2025

Looks like you have a marketplace app Rich Filters for Jira Dashboards that you want to use. Is that correct?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events