Dataview query unfinished daily tasks from a week (last, this, or one particular)

Hello. I use Periodic Notes plugin to create Daily notes (title formatted as YYYY-MM-DD) in Journal/Daily and Weekly notes (title formatted as gggg-[W]ww, for example 2023-W31) in Journal/Weekly. My daily notes contain my daily tasks. I use Templater to automatically link each Daily note to its respective Weekly note, and vice versa (as in the screenshot below).

What I’m trying to do

I’m getting started with Dataview, and I’m trying to make a query to see what tasks I haven’t completed from last week and this week.

Things I have tried

My idea:

  1. Perform some calculation and formatting to get the date with format similar to the Weekly notes from last week and this week
  2. Use outgoing([[ the weekly note file name ]]) to look at all the daily notes of that week
  3. Check unfinished tasks with !completed

I’m getting stuck at step 1, I’ve been trying to work around with dateformat() (as in the screenshot below) but seems like I couldn’t get the correct name for my Weekly note.

I don’t think about directly calling days from last week using calculation with file.cday or file.mday because I usually plan a head certain tasks for every day in the next week, so the creation date is not actually from that week, and some days I forget to check the tasks so they’re not modified at all.

I’d really appreciate some help, thanks a lot!

I made a typo in the dataview code in the second screenshot. Here’s the code reflecting my idea:

FROM outgoing([[dateformat(date(today) - dur(7 d), "kkkk-'W'WW")]])
WHERE !completed

From the documentation of Luxon, I wrote “kkkk-'W’WW” hoping that it will convert to the format of [week year]-W[week number], like 2023-W31

A kind member on Discord enlightened me that FROM doesn’t accept functions, and helped me with the code. I can now query unfinished tasks from last week with

FROM "Journal/Daily"
WHERE !completed and econtains(file.outlinks, link(dateformat(date(today) - dur(1 w), "kkkk-'W'WW")))

Hopefully this will be helpful for those with similar ideas!

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