List notes within a weekly/ monthly note that have a due_date or do_date fall within that particular week/month

What I’m trying to do

I use the Calendar and Periodic Notes Plugins to create daily, weekly and monthly notes and want to have dataview create a list of notes which have a Due_Date or Do_Date within the given day, week or month. This is basically so I can see what is due in that particular week or month so I can plan to get these things done.

I input the Due_Date and Do_Date in the YAML front matter and use Templater to insert the following into each of my daily notes:

Table Do_Time as "Time", Do_Date as "Do", Due_Date as "Due"
Where (Due_Date = "<% tp.file.title %>" or Do_Date = "<% tp.file.title %>")
sort Time asc

This will display any notes that are do/due on a particular day, but I am struggling to find a way to get a similar outcome for weekly and monthly notes (I have left out my personal tagging system to make things clearer).

Any help would greatly appreciated as I have been unable to find a workable solution :).
*Edit: Grammar

I support the idea.
I found it interesting to use it as a book of problems. And divide tasks into time blocks, and not according to priorities, etc. But the functionality seems to be limited, or not available to everyone.

1 Like

I use this option for daily notes, and the others, unfortunately, do not work. Listed them as an example.

Task FROM "Notes/Days"
where file.day = date(today)

Example 1

Task FROM "Notes/Weeks"
where file.week = date(this week)

Example 2

Task FROM "Notes/Monts"
where file.monts = date(this monts)

Example 3

Task FROM "Notes/Years"
where file.year = date(this year)
  1. What’s the format of your daily notes?
    I deduce you use YYYY-MM-DD format because you use the templater expression “<% tp.file.title %>”.
    But if you insert the dataview query in a daily note with the title in that format, then you don’t need to use any templater expression, just something similar to this:
```dataview
TABLE Do_Time AS "Time", Do_Date AS "Do", Due_Date AS "Due"
WHERE Due_Date = date(this.file.name) OR Do_Date = date(this.file.link)
SORT Do_Time ASC
```

(you can use “this.file.name” or “this.file.link”)

  1. About weekly and monthly notes, I don’t know how to extract “data” from this notes (I don’t use the mentioned plugins): dates, weeks, etc. What’s the title format of your weekly notes? How you define the start and the end of the week? Have you any extra field in your frontmatter to define the week interval?

For example, with some title format, it’s possible to list all notes based on “week of the year”:

```dataview
TABLE Do_Time AS "Time", Do_Date AS "Do", Due_Date AS "Due"
WHERE date(Due_Date).weekyear = date(this.file.name).weekyear OR date(Do_Date).weekyear = date(this.file.link).weekyear
SORT Do_Time ASC
```
1 Like

These examples explain little…
For example, what you want with your first query?

Task FROM "Notes/Days"
where file.day = date(today)

A list of tasks from files where the “day” date (in title format) is equal to today date?
This is the meaning of your expression where file.day = date(today).

I can help you if you explain better your intend: what you want, where are the tasks, if you define “due date” or similar to your tasks, etc.

This is the format I use for task lists.
Screenshot (Imgur.com)
This is how I want it to work
Screenshot 2 (imgur.com)

Date format based on Peridic Notes:
Day - YYYY-MM-DD
Week - gggg-[W]ww
Months - YYYY-MM
Year - YYYY

I need more clarifications…

  1. You want a note where you list all your tasks (incompleted or incompleted+completed?) by “Day” (today), “Week” (this week), “Month” (this month) and “Year” (this year)
  2. Where are placed your tasks? Inside your daily notes? In weekly notes too? Or monthly? Which is the source? If the source it’s only in daily notes, then it’s more easy because your date format titles)
  3. The previous question is important because you need to clarify what gives a “date” to your tasks! It’s the date in the title of the note or you have any inline-field in each task with the “due date”? It’s important to know where to capture the date for your tasks: at page level or at tasks level? If in tasks level, how do you add this in-line field?
    Data Annotation - Dataview
    Or you use the “Tasks” plugin?
  1. For filling notes I want to use Periodic Notes. That is, all tasks are in the note file. For example, I use a daily habit tracker and add daily / weekly / monthly notes as needed. All tasks must be completed and incomplete to see progress. The source is the name of the note.
  2. The format of the note name is taken from Periodic Notes. In the example, I just indicated tags in order to see what I want to do.
    I want it to work without my participation. That is, now week number 46 of 52 (365/7).
    Week is Actually - 2021-W46.md
    Months - 2021-11.md
    Year - 2021.md
  3. I use Dataview because I like it better than Tasks. And for notes of the format - Completed / Not completed, I want to use a different format such as Projects, which will not be in the Periodic Notes FILES. That is, as in the picture, at the very bottom of the “Repeatable Task” there will be Tasks that are “polished”. Not requiring supplementation, and just waiting for the moment of activation, and repetition.

The same can be done using tags, if you force obsidian to automatically update the current week / month / year by putting a tag in the format # Week / Actual, # Month / Actual, # Year / Actual.

In this format, you need to pull up, from the base.

{{date:gggg-[W]ww}}

{{date:YYYY-MM}}

{{date:YYYY}}

  1. For clarification, I don’t use Periodic Notes plugin (neither daily notes base system), because that my questions about the “sources” of your tasks and where it’s possible to extract the “date” for your tasks.

  2. If I understand well, you place your tasks in any of your periodic notes (daily, weekly, …) and don’t have any particular date associated to each task. If so, which is the relevant date to consider? The date of the task creation, not the due date? Considering the “creation” date:
    a) in daily notes there’s no problem because two reasons: the title is in the format yyyy-mm-dd (or yyyymmdd) and the creation date of the note/page is based in specific date (creation date = daily note date).
    b) in weekly, monthly… notes, title format ins’t a readable “date” for dataview and the more immediate date to capture is the note creation date. This date (creation date) is acceptable for your tasks date?

  3. You can try this examples:

today

TASK
WHERE file.cday = date(today)

week

TASK
WHERE date(file.cday).year = date(today).year
WHERE date(file.cday).weekyear = date(today).weekyear
WHERE file.cday != date(today)

(in this query it’s necessary to filter tasks to the current year - because the week number repeats every year -, and exclude the “today” tasks to avoid the repetition of the same tasks presents in the previous “today” query)

month

TASK
WHERE date(file.cday).year = date(today).year
WHERE date(file.cday).month = date(today).month
WHERE date(file.cday).weekyear != date(today).weekyear

(tasks filtered to present month - not 30 days - and excluding the “this week” tasks to avoid repetition with “week” tasks)

year

TASK
WHERE date(file.cday).year = date(today).year
WHERE date(file.cday).month != date(today).month

(taks filtered to present year - not 365/366 days - and excluding the tasks from “this month” to avoid repetition)

NOTES:
a) By default dataview listed tasks by files, i.e. group of files. If you want a list as a single group you need to create a (non-existente) single group. Add this at the end of each query:

GROUP BY "Tasks" AS abcd

b) If you want to separate completed from non-completed tasks, you need to add these conditions:
(for only non-completed tasks)

WHERE !completed

(for only completed tasks)

WHERE completed

Thank you for your responses and apologies for the delay; I was under the impression I would get an email notification when I received a reply, but that is my fault.

I realise now that I may have been somewhat vague in my initial post, so I have expanded on my approach in the hope to avoid inadvertently missing something out.

Thank you for your suggestions, here are my response to your queries:

  1. I use YYYY.MM.DD - (Dots rather than dashes out of habit - I have changed the default in settings so this should have no effect though).
    1. I attempted using “WHERE Due_Date = date(this.file.name) OR Do_Date = date(this.file.link)” but unfortunately the dataview then pulled every entry in from my vault.
  2. The title format is still up for grabs. I currently use “gggg-[W]ww” which outputs the year followed by the week.

Screenshots -
https://imgur.com/a/Wmwxw9M

I personally have not found the tasks functionality within obsidian to be useful and have tried to solve the issues I was having by using dataview.

My approach is as follow:

  1. All notes created will receive a tag based on their completion status:
    :red_square: Not Started
    :yellow_square: Started
    :orange_square: Waiting On
    :brown_square: Return To
    :green_square: Completed
  2. If I would like to complete them on a particular day, I will input a date next to “Do_Date:” and a time next to “Do_Time”. I will also assign a priority to a task if it has not been scheduled so that the most important tasks float to the top of my outstanding files list, but I digress.
  3. This date and time will be picked up when a daily note is created on the set day using dataview (Using periodic notes and calendar - please see the above images for examples).
  4. I will complete the task, change the status (i.e. from not started to completed or anything in between) and move on to the next task.

I capture the date that a file scheduled within the YAML of each note under “Due_Date” so cannot use the .month or .year adjuncts which one could use with the file.ctime or file.mtime.

My approach works well for daily notes with my current template, but I am lost as to how to make this work for weekly, monthly and yearly notes. For example, If I were to open 2021-49 (Week 49 of 2021, commencing on Monday 6th December) I would like the dataview table to show all tasks scheduled for this week 49 (6th December to 12th December).

Take the following string:
Where (Due_Date = “<% tp.file.title %>” or Do_Date = “<% tp.file.title %>”)
Would output:
Where (Due_Date = “2021-49” or Do_Date = “2021-49”)

I was hoping that the dataview could query the Due_Date and Do_Date and return any dates that occurred within, say, week 49 of 2021.

Potential Ideas (with my limited knowledge)

  1. What if I were to change the title format of a weekly note to something different (Moment.js | Docs). Is there a way that one could then filter in the way described above?
  2. I could change the format to YYYY.MM.DD. Would this then enable one to use some formula to add 6 days to this date and search for files that have a due_date or do_date that falls between the two dates (Or on)? I would be hesitant about this though as I would then need to alter my daily notes format, so could run in to some more issues.

I entirely appreciate that you do not use daily notes so this may be outside your scope but I appreciate the feedback.

Hi.

Considering your long and descriptive answer, it’s better start from a basic “point” and later we can discuss other details.

As obvious conclusion, the main point is… dates.

My main suggestion is this: for dataview purposes, every entries (titles, values in fields, etc.) with reference to dates should use the format YYYY-MM-DD.

With this format you can work with dates in a more flexible way:

  • extract date from title;
  • make some durations calculations with the values (dates) in your fields;
  • define the format you want to present in results (with the function dateformat() you can choose the output format);
  • you can do this: «I capture the date that a file scheduled within the YAML of each note under “Due_Date” so cannot use the .month or .year adjuncts which one could use with the file.ctime or file.mtime.»;
  • no need to use templater expressions like <% tp.file.title %>;
  • etc.

For weekly, monthly and yearly notes, it’s necessary other approach.
In weekly notes (format gggg-[W]ww), monthly or yearly, titles aren’t a readable “date” for dataview and the more immediate date to capture is the note creation date (as I said before to @Create). If this isn’t a problem for you, then is possible to solve your wanted queries.

Before any other step, what you think about this?

(btw, by default dataview uses ISO8601 dates - Data Annotation - Dataview -, but it’s possible to extract results in luxon format)