Can't seem to limit table to just a specific month

I have a group of daily notes in a folder “timely.” They are all named by the date YYYY-MM-DD they were written. When I write a table looking for the file.name as a date it displays them as expected:

table without id file.name, date(file.name).month as Date
from "timely"
sort file.ctime desc

however, when I add the where statement to limit to just this month, it fails.

table without id file.name, date(file.name).month as Date
from "timely"
where date(file.name).month = date("2021-11-27")
sort file.ctime desc

I have tried changing the where statement to:

  • where date(file.name).month = “2021-11-27”
  • where date(file.name).month = “2021-11”
  • where date(file.name).month = “11”

as well as using the file.day function:

  • where date(file.day) = date(“2021-11”)
  • where date(file.day) = date(“11”)
  • where date(file.day) = “11”

And a bunch of other stuff. I can list them if you want to see them.

I have searched Duck Duck Go for dataview obsidian monthly review, dataview obsidian file.day and a bunch of other searches.

I have searched in this forum for similar search strings. I have relied heavily on @arminta’s post in here " Daily and Weekly Reviews + dataview" It has gotten me all the way to a working weekly review, and I am VERY grateful for it. Thank you!

What I’m trying to do

I am trying to create a template for my monthly reviews that looks at the current date and the date in the file name of the file to pull out various bits of data with dataview.

I don’t want to use ctime or mtime because these notes might be created well in advance of the day they are written for (for instance, I note calendar entries in my calendar before the day they are scheduled to happen, so I can remember to attend the events…). And they may be modified at any time as well.

I will use templater to set the specific date entries - so for testing above I’m not worried that it’s using today’s date as the default. BUT I don’t want to assume that I’m writing the review in the same month that I’m reviewing.

Hi, I think something closer to this should work:

table without id file.name, date(file.name).month as Date
from "timely"
where date(file.name).month = 11 and date(file.name).year = 2021
sort file.ctime desc

When comparing .month and .year things, the values are just numbers, so they don’t need to go in quotes.

1 Like

Okay, I’m closer:

dataview
table without id file.name, date(file.name).month as Date
from "timely"
where date(file.day).month = date(2021-11-01).month
sort file.ctime desc

This gets me a table like I want, BUT it culminates in an error message:

Dataview: Every row during operation ‘where’ failed with an error; first 3:

            - No implementation of 'date' found for arguments: object
  • No implementation of ‘date’ found for arguments: object
  • No implementation of ‘date’ found for arguments: object

I’m guessing that is because there are files in that folder that don’t match the YYYY-MM-DD format.

Any ideas what I can do about this?

Awesome, that worked too, and would be better than my initial idea as I wouldn’t be seeing every year’s November listings.

I’m still seeing the error message (because of the mis-named files) and I’m debating just moving those somewhere else as a kludge.

Thank you!

Oh, I see what you mean now. For that issue, I think you want to do the following then:

table without id file.name, file.day.month as Date
from "timely"
where date(file.name).month = 11 and date(file.name).year = 2021
sort file.ctime desc

Dataview already does some magic to convert filenames to dates. So I think if it can’t find a date in the filename it will just show - instead of the error.

Use file.day as Date for it to show the full date (i.e. “November 11, 2021”) etc.

1 Like

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