How to add a week number in Dataview where-criterium

Things I have tried

Searched Dataview and Templater help texts.

Currently am using manually adding the week number

dataview
table without id prio AS “Weekprio”
from “zJournal”
where contains(file.name, “week”) AND prio AND contains(file.name,“17”)

What I’m trying to do

I would like to see in my Today-dashboard note the week priorities in mention in my Weekly Note. I have them in that note following prio::

To only see those of this week I would like to add ‘where’ with this week’s number minus 1. Is there a way to do this?

Thanks in advance,

Arjan

  1. How you define the week number in your weekly note? A number in title? Using any plugin? There’s some differences between moment locale format and the iso format used by dataview (because different rules for the first week of the year and the locale rules for the first day of the week). For example you can check the today week (for dataview) with this inline query:
`=date(today).weekyear`
  1. If for today dashboard you can use the dynamic value extracted from date(today).weekyear and compare with something (I don’t know if you have any date value in your weekly note or just a number in the title)… And you can use calculations as:
`=date(today).weekyear - 1`
1 Like

The week number is added to the title by Periodic Notes and I have {{title}} in the template to see it in the note. So that would not be helpful.

I can add ‘weeknumber:: {{date:w}}’ to the template so I have a week number.

please give an example of your weekly note title…

This did it!

I have added ‘Weeknummer:: {{date:w}}’ to the weekly template.

prio = the week priorities mentioned in every weekly note
zJournal = the folder where all the periodic notes live

The table now is:

table without id prio AS "Weekprio"
from "zJournal"
where Weeknummer = date(today).weekyear - 1

Thanks!

ok. later, if you continue with this system, you need to add also the year (because you have the same “weekyear” every year. :slight_smile:

1 Like

Another point: if you use {{date:W}} instead of {{date:w}} you get automatically the week in iso format, avoiding the minus 1 in the query.

1 Like

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