Hi everyone!
For the last days I have been struggling with – what I thought – would be a simple query within Dataview with the Tasks Plugin; however, I do not make it work and are in desperate need of help.
What I’m trying to do
Would like to take the sum of time planned for tasks.
What I have tried
This is the list of tasks from “Notes/Tasks”
- Test task (time:: 1)
- Test task (time:: 2)
- Test task (time::3)
… and this is the query:
TABLE WITHOUT ID
sum(number(rows.time)) as time
FROM "Notes/Test"
WHERE schedueled = date(before.tomorrow)
AND status !="x"
Would love to get the total of time from the tasks. It doesn’t need to be a table, could just be “Time planned 3”.
If anyone has a good idea to realize is, would
Thanks!
Meindert
First of all you seem to be mixing the concepts, as you present a table query used by dataview plugin, and at the same time present the display of some tasks where the origin is unknown. Are those from a tasks query, or a dataview query, or are they just the display of the tasks in one of your notes?
Secondly, the sum()
function needs to get an array to sum the values of. This could be something like file.tasks.time
(which would be the time fields of any file in your query), or it could be something like rows.something
(where the rows
list is only populated if you do GROUP BY
before using it.
So which tasks do you want to sum the time off, and what is your current query to list those tasks?
Thanks for helping! As you got i’m fairly new to obsidian.
Would like tot get the sum of time with each task. Kinda like showed, each time has a value of time and then a querry of te total of time in de note.
Within just the current file you could do this:
Sum: `= sum(this.file.tasks.time)`
If you want for multiple files, and/or filter out completed tasks it’ll look different.
There has been many queries in the forum though on how to do this, so a little bit of searching could be advisable. And answering questions is always good… Not just repeating the vague description from before.
Step 1 for me is to do it within the note. Step 2 is for me to get the sum within the folder
How would it look in that case?
is there a way to filter out the completed tasks?
When I put in the code block of Sum: = sum(this.file.tasks.time)
With the following examples
- Test taak (time:: 1)
- Test taak (time:: 2)
- Test taak time:: 3
I’m getting an error message of “Dataview (for inline query ‘= sum(this.file.tasks.time)’): No implementation found for ‘number + null’”.
Aka, which nood mistake am i making?
That last line is not actually a property, and the simple cases lifts all tasks, so if there any without the time
inline field, it’ll fail.
What about this variant:
`= sum(nonnull(this.file.tasks.time))`
Does that give a better response?
Found the issue 
The new variant gives the correct response! Thanks for helping!
Project is a step further