Sum up logged work on tasks to epic level - double counting entries
Asked by Brellison:

My goal: Create automation that will sum up the time spent entered on tasks to the epic level.  

Problem: The below automation works... to an extent. If I enter 1h on a task within an epic, it will show 1h logged on the epic. If I log another 1h on the same task or another task within the same epic, then it will show 3h logged on the epic. This makes me believe the automation sums up all time spent entries (previous and new ones). Is there a way to get the automation to only sum up new time spent entries since the last time the automation was run?  

<br />

![Screen Shot 2022-04-26 at 1.54.55 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/194727i18617D53B8ACB7E4/image-size/large?v=v2&px=999 "Screen Shot 2022-04-26 at 1.54.55 PM.png")


Answers:
author: Darryl Lee
body: Hi - so I see a few issues:

* You probably want to add a condition so the rule only runs when you're logging time on a TASK.
* You probably just need to add this value to **Log work:**{{worklog.timeSpent}} for the Epic and you don't have to Lookup anything.

So how this would work is:

You update **task** PROJECTX-123 which is part of **epic** PROJECTX-123.

* Rule checks if it is a Task (because if it is an Epic, you would not want to double-log the time.)
* If it is a Task, the For Epic (parent): Log work {{worklog.timeSpent}}

comments: author: Darryl Lee
body: (You don't have to check for only Task. It can be any child-Issue Type.)

![Screen Shot 2022-04-26 at 1.25.16 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/194730i50F0847F6342A1BB/image-size/large?v=v2&px=999 "Screen Shot 2022-04-26 at 1.25.16 PM.png")


author: Brellison
body: Sweet! This fixes my problem. Thanks [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322)


author: Joseph Gardener
body: Is there a way for Subtasks to roll Up. Currently my automation looks like this but the sub tasks time entry is not rolling up to EPIC. Stories, Bugs and Task Issue Types work fine. Just not sub tasks.

![Time Entry Rollup.png](https://community.atlassian.com/t5/image/serverpage/image-id/209828iDFACF9C143664086/image-size/large?v=v2&px=999 "Time Entry Rollup.png")


author: Vinod Kotiya
body: Here is the solution to Rollup time spent to Epic Level. When time is lgged in Task/Stories and Subtask level. Working perfectly fine.

First check is for non-Epic, a second check is for some subtasks.

![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/234659i327ACC2178EE09DC/image-size/large?v=v2&px=999 "Capture.PNG")


author: Yatish Madhav
body: Thanks for the post and the comments, all.

I have noticed many articles like this BUT it seems either something is missed or it is flying over my head :D

With trigger Work logged for all operations, does the update or delete of task worklogs reflect on the Epic? I noticed that if it is updated, the new time is added to the epic and if existing worklog is deleted, that same time is added to the Epic. Both of these seem incorrect. Also, it does not look like we can identify if it is added , updated or deleted.

Any idea please?

comments: author: Yatish Madhav
body: Here is a screen grab.

The add work log, update work log and delete work log all log the time additionally to the Epic where it should actually add/update/delete accordingly. i.e expecting the Epic to have the same work log total as the child issues, but the Epic simple appends the total that is added, updated and delted as well.

Hope that helps in helping me :)

![Screenshot from 2023-10-10 17-10-31.png](https://community.atlassian.com/t5/image/serverpage/image-id/285440i4E73713E7CA0792F/image-size/large?v=v2&px=999 "Screenshot from 2023-10-10 17-10-31.png")

Thank you


author: Aaron Geister
body: I am currently trying to get this same automation to work but when you make changes to the child issue time the audit logs show "NO ACTIONS PERFORMED"  

It is the same automation as what is above.