Tasks query, tasks completed in weekly, monthly, quarterly notes

With the information you give (for now) we can try an example for your weekly note.
For monthly cases and others we don’t have info enough to define “where we have a valid date information - other than the creation date - to compare with the daily notes dates”.
So, for weekly note I’ll take as example the title/name format “2022-W38”.

# weekly

```dataview
TASK
WHERE file.day.weekyear = number(split(this.file.name, "W")[1])
WHERE completed
WHERE contains(tags, "#keydaily")
```

Explaining:

  • WHERE file.day.weekyear = number(split(this.file.name, "W")[1])
    • file.day it’s an implicit date if the note title has a valid date in it. For the case, 2022-09-25 Sun, it extract the date 2022-09-25.
    • file.day.weekyear - extract the week-of-the-year from the valid date, in case the number 38
    • split(this.file.name, "W")[1]- now I take the file name of the current file (2022-W38) and extract the number after the “W”
    • number(split(this.file.name, "W")[1]) - because the split() results are strings, we need to use the function number() to transform the string “38” in the number 38.
    • WHERE file.day.weekyear = number(split(this.file.name, "W")[1]) - now we define the filter condition: «only files where the number of the week-of-the-year date is equal to the week number we extract from the current weekly note title.
  • WHERE completed - filter only completed tasks
  • contains(tags, "#keydaily") - filter only tasks with the tag #keydaily in the content
2 Likes