First column - a list of all the tasks in the specified folder (Diary/Daily)
Second column - the count of how many notes have the matching task.text (from the first column) marked as complete
Using the query I can change the time frame to create different dashboards that will show the completion metrics for a week, month or year etc.
I was using Read Book as an example since if I can figure out how to show the “Completion” count of all tasks matching “Read Book” for a period then I should be able to figure out how to replicate for a larger list.
Right now I am able to show a list of all notes that have “Read Book” completed but to your second point, I cannot figure out how to show the sum
Col1 ---------------- Col2
Read Book 32 [ THIS WOULD SHOW THE COMPLETION COUNT]
Task 2 12
Task 3 8
etc
Regarding your second point - it sounds like you are saying showing the completion count in the format I’ve shown above is not easily possible without using dataview + js (too complicated for me right now)
Could you elaborate or point me to resources on how I could “but you can get the value (the sum) in a separated query/table”
My declaration was related with a total at the bottom of a column (as a sum of the values in rows above). That’s why I said “in regular DQL queries you can’t add a sum at the bottom of the column”. But your case is different: you want a column with a total per row (related with the group in first column).
I’m still not sure about your goal: if you want to see all tasks text but only the total for the completed; if you want to see only the task text for the completed (and the sum); etc… because you said:
So, play with this query:
TABLE WITHOUT ID
key as Tasks,
length(rows) AS Total,
rows.file.link AS "Files for total",
length(filter(rows.tasks, (r) => r.completed)) AS Completed,
filter(rows, (r) => r.tasks.completed).file.link AS "Files for completed"
FROM "your/folder/path"
FLATTEN file.tasks as tasks
GROUP BY tasks.text
SORT length(rows) DESC
Thank you, this has been very helpful. The documentation on Dataview seems scanty, I have been trying to find documentation on how to use the filter and flattenn function. The table it’s creating has the right numbers but I’m trying to figure out how to get rid of the “Files For Total” and “Files for completed” columns since they add too many lines.
TABLE WITHOUT ID
key as Tasks,
length(rows) AS Total,
length(filter(rows.tasks, (r) => r.completed)) AS Completed
FROM "your/folder/path"
FLATTEN file.tasks as tasks
GROUP BY tasks.text
SORT length(rows) DESC