How to sum the time of the subtasks in the estimated time of the parent item?
Asked by Adriana Almeida da Cruz:

Hi all!

No Jira Work Management, eu estou tentando aplicar uma regra para que o tempo estimado das subtarefas sejam somadas no item pai. Acontece que aparecem estimativas de prazo muito altas porque est? somando cumulativamente de algum lugar.

Onde estou errando?

Esta foi a regra que apliquei.

In Jira Work Management, I'm trying to apply a rule so that the estimated time of the subtasks are summed in the parent item. The problem is that very high term estimates come up because it's cumulatively adding up from somewhere.

Where am I going wrong?

This was the rule I applied.

![jira 1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/256628i304046087F70ECF0/image-size/large?v=v2&px=999 "jira 1.jpg")

I use different items as a working model to clone the new items, and even when I unlink the model item, the estimate doesn't change.

![jira 2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/256633iA5065C07F746084D/image-size/large?v=v2&px=999 "jira 2.jpg")

Someone can help me?


Answers:
author: Trudy Claspill
body: Hello [@Adriana Almeida da Cruz](/t5/user/viewprofilepage/user-id/5196152)

Can you show us the Estimates on the subtasks?

I see in your Automation Rule you are setting the Original Estimate value to:

**{{issue.subtask.Original Estimate.sum()}}d**

Is the "d" at the end because you want to set the Original Estimate to a number of days?

It looks like the value is being displayed in seconds, based on the "s" shown at the end.

**1203840s**

Regardless of how the Time Estimates are displayed on the screen (in minutes, hours, days, or weeks) the actual value stored in the Jira database in seconds. Jira automatically converts the seconds value stored in the database to display the value in the UI.

When you use the **sum**function on this field Jira is summing up values that are in seconds. If you want to submit that value as days you need to divide the number by 28800 to get seconds converted to days that are 8 hours long:

```
Your value in seconds * 60 = minutes
minutes * 60 = hours
hours * 8 hours per day = days
60 * 60 * 8 = 28800
```

You should be using this value to set your Original Estimate, I believe:

**{{#=}}{{issue.subtasks.original estimate.sum}} / 28800{{/}}d**

comments: author: Adriana Almeida da Cruz
body: Hi Trudy!

Thanks for your help!! : )

Yes, I want to set the Original Estimate to a days.  
And actually the "s" is for "weeks" or "Semanas" in portuguese.

In this case, I register the Original Estimate of subtask in days. But, JIRA transforms it into weeks.

In the exemple attached, the real original estimated should be 2 weeks and 4 days or 14 days as registered in subtasks, and as shown in timing traking. But, the Original Estimate is registering 80640 weeks. :(

![Captura de tela 2023-05-31 181825.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/260628i168AD53FFCFCC4B9/image-size/large?v=v2&px=999 "Captura de tela 2023-05-31 181825.jpg")


author: Trudy Claspill
body: Thank you for the clarification that the "s" is for weeks.

Your example confirms that the problem is you need to convert the value from seconds to days before you put the value into the field.

2 weeks + 4 days = 14 days (assuming 5 days/week)

14 days = 112 hours (assuming 8 hours/day)

112 hours = 6720 minutes

6720 minutes = 403200 seconds

If you submit 403200 as "days" then...

403200 days = 80640 weeks (assuming 5 days/week)

Voila! Your value of 80640 weeks in the Original Estimate field is explained.

So, as I said in my previous reply you need to convert the sum, which is in seconds, to days my dividing by 28800. You can do that with either of these commands directly in the value field when you set Original Estimate:

**{{#=}}{{issue.subtasks.original estimate.sum}} / 28800{{/}}d**

**{{issue.subtasks.original estimate.sum.divide(28800)}}d**