Calculating the total time to complete a task from its sub-tasks


#1

Hello,

Is it possible to calculate the total time estimate for a task from it’s sub tasks?

So I can create a custom field to record the estimated time to complete each sub-task. Then what I’d like to do is iterate through all the sub-tasks for a given task to determine the total time to complete a task. This would need to work at any level in the task hierarchy. I was wondering if there’s a possibility to do this programmatically?

I hope this explains it:

Task 1 - 9 Hours (Calculated)
Sub Task A - 4 Hours (Entered value)
Sub Task B - 3 Hours (Entered value)
Sub Task C - 2 Hours
Task 2 - - 9 Hours (Calculated)
Sub Task A - 6 Hours (Entered value)
Sub Task B - 3 Hours (Entered value)

Total time: 18 hours (Calculated)

But this should work no matter how many levels there are in the task hierarchy.

Steve


#2

You could definitely do this programmatically via the Asana API. The specifics would depend on your exact environment and programming language but you could pretty easily write code to iterate through a task and its subtasks, get the values of a numeric custom field and sum them up. You can post the specifics of your environment in the Developers & API Community section for further assistance.

One important thing to note, though you may also know this, is that since (a) a custom field is only accessible on a task if that task is assigned to a project which has that custom field attached to the project, and (b) subtasks do not inherit the project of their parent task, this means you will not see a custom field on a subtask by default. In order to enter the Hours on subtasks as in your example, those subtasks will need to be assigned to a project which has the Hours custom field attached to it.


#3

Hi Phil,

Thank you so much for your prompt and thorough reply.

I’m not sure what you mean by my environment, I’m just using Asana from a browser.

I’m also not that familiar with Asana, just getting started, so I didn’t know about the custom field not being inherited. I assume I can create a project template with the custom field set so that all tasks will automatically acquire the custom field automatically. I also assume that if I always create new projects from that template the custom field will always be applied to each task.

I can also see a problem with my idea, which is there needs to be some way to determine which tasks are bottom level as they are the only ones which should receive a manually entered value.

I’m really surprised most project management tools don’t seem to have this feature, I thought it would be more or less the default.

I’m not sure how to get started with development in Asana, though I am a developer, are there some good resources for how to get started?

Best Regards,

Steve


#4

Sorry, I meant your development environment - what platform and language you’d be using if you were to program against the Asana API.

Yep! If you make a custom field available in a project, and then you turn that project into a template, then any project you create from that template will have that custom field already attached to it. And when a custom field is attached to a project, all tasks assigned to that project have that custom field available to them.

The biggest drawback to assigning subtasks to a project (which, again, you’d have to do in order to enter Hours custom-field values in them) is that they then show up in the task list for that project, right alongside the top-level tasks.

Of course {shameless plug} there’s a great solution to that issue which is to use my Treesana application which displays subtasks in a true outline view. And while it’s not in the app yet, one feature on the road map is the ability to have it automatically calculate and display totals from numeric custom fields, which is really exactly what you’re wanting. :slight_smile:

The best way to get started is to read the Asana Developer documentation; I think it does a good job. What language would you be developing in? Hopefully it’s one of the languages for which there is a client library available.


#5

Hi Phil,

Thank you for your reply.

I think I must be missing something when you say assigning subtasks to a project, I thought they’d be assigned to a task. I’m able to add subtasks to a task by clicking the ‘subtasks’ button in the task details. In order to see the subtasks, I need to drill down and look at each one individual from the task details pane.

I’ve done a lot of jQuery so Javascript would probably be the best option looking at the client library.

Nothing wrong with a shameless plug :slight_smile: It’s a great idea but I’m afraid I wouldn’t be keen to have to install the app on every machine and lose the advantages of a web app.

Once again, thank you so much for your help.

Best Regards,

Steve