Aggregate total costs from field in a list of tasks

What I’m trying to do

I have the tasks list looking like that

- [ ] rent [amount:: 200]
- [ ] insurance [amount:: 100]
- [ ] groceries [amount:: 300]

In the same file I would like to show the sum of all of those financial obligations. The sum should be updated whenever I mark a task done.

I would be grateful for some useful tips on how to do it.

Things I have tried

I was looking into: Best Method to Display the Sum Total of a Dataview Column?
But still don’t know if I could apply something from it.

I’m trying to do inline query like:

**TOTAL**: `=round(sum(number(this.tasks.amount)), 2)` PLN

but cannot make it work.

You’re quite close, as you’re just missing a .file in there… :slight_smile:

Try the following:

**Total:** `= round(sum(this.file.tasks.amount), 2)`

Be aware that this will calculate the total, but if you change the amounts, it might take some time, or switching to/from reading view, or some other minor magic to make it recalculate the sum. This is related to dataview caching, and what triggers a re-run of queries in the current file.

1 Like

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