Average hours worked per task // Timesheet and DataView?

My job has many tasks. I want to know how many hours on average I spend on each type of task.

For each task, I open a note. For each of these notes, I put as a property the type of task I am working on. Within this note, I also added the “Super simple tracker”, where I mark the time worked. At the end of the task, I fill in the “Hours” property with how much was spent.

With the dataview, I was able to filter by a specific task and know exactly how much time I spent.

However, I can’t make a way to add these hours and make an average work in DataView. I can’t even add them together.

What i currently have is this:

TABLE class, hours, ID
FROM "004 Work"
WHERE class = "Protocol" and concluded
SORT file.name asc

It goes like this:

File2 class hours ID
Link Protocol 1 hour, 2 seconds -
Link Protocol 2 hours

What I’ve tried and failed is this:

TABLE sum(rows.hours)/length(rows.hours) as "avg hours"
FROM "004 Work"
WHERE class = "Protocol" and concluded
SORT file.name asc

If you have another plugin or another way to do this, that is, to obtain an average of hours worked for a specific task, please tell me.

I ask for help!!!

To be able to use sum() and average() function you need to group your results, so in your simple case it could look like:

```dataview
TABLE average(rows.hours) as "avg hours"
FROM "004 Work"
WHERE class = "Protocol" and concluded
GROUP BY true
```

If you want to take the sum/average based upon various protocols you could do:

```dataview
TABLE average(rows.hours) as "avg hours"
FROM "004 Work"
WHERE concluded
GROUP BY protocol
```

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.