Dataview query to display notes with a deadline during a quarter

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

I am trying to create a dataview query that displays all files with a deadline that falls during a given quarter. Each of the files has a deadline for a month during that quarter. The name of the file is the quarter. So for example example, I’ll have a file named 2023-Q4, and I want it to show files with a deadline 2023-10, 2023-11, and 2023-12.

Things I have tried

So far I have tried using date format without much luck. Here is my query so far:

dataview
TABLE dateformat(date(Scheduled), "q") AS Scheduled
WHERE dateformat(date(Scheduled) = dateformat(date(this.file.name), "q")

What format are you using for Scheduled?

If it’s in the recognised format of YYYY-MM-DD, then your statement should rather look like:

WHERE dateformat(Scheduled, "yyyy-Qq") = this.file.name

for some reason when I use this nothing turns up. I have scheduled:: 2023-12-01 in my note

It somewhat works the problem is I have the date setup for the week notes as 2023-W45 for example. I can’t get dateformat to recognize the W

I’m not quite sure I’m following this last step related to week notes, but dateformat() requires a full date not just a partial date as given using something like “2023-W48”. However, we could use date(text, format) to transform it. So try doing:

WHERE dateformat( date(Scheduled, "kkkk-'W'W"), "yyyy-Qq" ) = this.file.name

Or is it the file.name which could become 2023-W48 so you’d rather need to change that into something like:

WHERE dateformat( Scheduled, "yyyy-Qq" ) =
    dateformat( this.file.name, "kkkk-'W'W"), "yyyy-Qq" )

Hope this helps, and that I’m not missing the target completely.

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