literally yesterday I set up something similar for myself. i used tasks plugin and created a template I insert to each daily note.
this is how my template looks like
## upcoming
```tasks
not done
sort by due
description does not include canceled
due after today```
## todo
```tasks
not done
description does not include canceled
due before tomorrow```
## backlog
```tasks
not done
description does not include canceled
path includes daily
no due date```
## worklog
```tasks
done after last two days```
# notes
Completed tasks. (for all notes ignore FROM "", if any particular folder - or tag - specify FROM "yourdailynotefolderpath-or-#yourtag)
```dataview
TASK
FROM ""
WHERE completed
```
Tasks completed from yesterday note. If you use the format (YYYY-MM-DD) on file name, you can do something like this:
```dataview
TASK
FROM ""
WHERE completed AND file.day = date(today) - dur(1day)
```
(“file.day” extract date from title)
Try and tell me if works as you wanted
EDIT: well, one problem. In this case dates are relative, not absolute. I.e, today is today and yesterday is yesterday. If you use this query in regular way, when you go back for example for the note a week ago, “yesterday” is the relative to today, not to the date of the daily note. To solve this is necessary other approach.
In this case, if you use templates via Templater to create your daily note, then is possible create a dataview “auto-query” with exact dates.
Query in template:
```dataview
TASK
FROM ""
WHERE completed AND file.day = date(<% tp.date.now() %>) - dur(1day)
```
This works beautiful, but only for today’s note. If I pick any other daily note (for example yesterday’s or tomorrow’s note) it will list all finished tasks of yesterday (absolute), not relative to the daily note.
I tried:
WHERE completed AND file.day = date(<%tp.file.title() %>) - dur(1day)
WHERE completed AND file.day = date(<% tp.date.now() %>) - dur(1day) works for the moment when you create the daily note. If you try to insert the query in notes already created, then you need another approach!
You want to insert the query in daily notes already created?
Yes, if I browse back to any previous date, I’d like to see what the wins of that previous day were.
Also: it happens sometimes that a daily note for a future date is created today. By the time that note is viewed, it should show the wins of the day before.
So I guess the date needs to be derived from the filename (YYYY-MM-DD) - 1 day. Would that be possible at all?