Dataview task query

OK, I’ve poured over the docs. I’ve gone through the dataview example vault. I’ve tried everything.

Here’s a working task dataview:

FROM "work"
WHERE status = "x"
AND completion = date("today")

It shows me a beautiful list of work tasks completed today.

The problem is that I want this query in all my daily notes, and I want the date to be from the note itself.

I have these properties that are in the note:

file.frontmatter.created = 2024-05-31 18:10

And an inline property:

reference_date:: 2024-05-31

I’ve tried the 37 different variations listed below (looks like the list may get truncated), and nothing works. Some of these return some tasks, other return errors. But nothing returns the same results as the query above.

This query would be very valuable to me at work. I hope someone knows how to do this.


  1. AND completion = date(“2025-05-31”)
  2. AND completion = “2025-05-31”
  3. AND completion = date(
  4. AND completion = date(created)
  5. AND completion = dateformat(created, “YYYY-MM-DD”)
  6. AND completion = created
  7. AND completion = dateformat(created, “YYYY-MM-DD”)
  8. AND dateformat(completion, “YYYY-MM-DD”) = dateformat(created, “YYYY-MM-DD”)
  9. AND completion = date(dateformat(created, “YYYY-MM-DD”))
  10. AND completion = " :white_check_mark:" + dateformat(created, “YYYY-MM-DD”)
  11. AND completion = " :white_check_mark:" + created
  12. AND completion = ":white_check_mark: " + dateformat(created, “YYYY-MM-DD”)
  13. AND completion = ":white_check_mark: " + created
  14. AND completion = date(file.frontmatter.created)
  15. AND completion = dateformat(file.frontmatter.created, “YYYY-MM-DD”)
  16. AND completion = file.frontmatter.created
  17. AND completion = dateformat(file.frontmatter.created, “YYYY-MM-DD”)
  18. AND dateformat(completion, “YYYY-MM-DD”) = dateformat(file.frontmatter.created, “YYYY-MM-DD”)
  19. AND completion = date(dateformat(file.frontmatter.created, “YYYY-MM-DD”))
  20. AND completion = " :white_check_mark:" + dateformat(file.frontmatter.created, “YYYY-MM-DD”)
  21. AND completion = " :white_check_mark:" + file.frontmatter.created
  22. AND completion = ":white_check_mark: " + dateformat(file.frontmatter.created, “YYYY-MM-DD”)
  23. AND completion = ":white_check_mark: " + file.frontmatter.created
  24. AND completion = date(reference_date)
  25. AND completion = dateformat(reference_date, “YYYY-MM-DD”)
  26. // These two pull one task from 3 days ago
  27. AND completion = reference_date
  28. AND completion = dateformat(reference_date, “YYYY-MM-DD”)
  29. // Seems to pull all tasks
  30. AND dateformat(completion, “YYYY-MM-DD”) = dateformat(reference_date, “YYYY-MM-DD”)
  31. AND completion = date(dateformat(reference_date, “YYYY-MM-DD”))
  32. AND completion = " :white_check_mark:" + dateformat(reference_date, “YYYY-MM-DD”)
  33. AND completion = " :white_check_mark:" + reference_date
  34. AND completion = ":white_check_mark: " + dateformat(reference_date, “YYYY-MM-DD”)
  35. AND completion = ":white_check_mark: " + reference_date

For dataview to recognise the a date with a time part, you need to separate the parts with a T like in 2024-06-01T23:57. See Data Types - Dataview

Since the other variable doesn’t include the time part completion = reference_date should work just fine. So it’s strange if that doesn’t work. (Where do you place the reference date? In the task of outside of the task? )

You can coerce the other textual date variant to become a date, but let’s retry the variant above first.

PS! If you want to pick the reference field from the note where your query is you need to use this.reference_date. If you don’t prefix with this. is going to look in the task itself (or the note which contains the task) for that value.

1 Like

Does a simple query produce consistent results?

WHERE completion = date(today)


WHERE completion = date(

Ah, thank you for the tip on inline variables. I see that this.var refers to the var associated with the current note, while var in a query is going to refer to each of the query results. That makes sense.

I ended up using templater to get this to work:

AND completion = date("<% tp.file.title %>")

So that placeholder will be replaced with the current date/filename when the note is created (as you know :).


I didn’t try that since I knew it would not work in a daily note.

Given a proper file title in the YYYY-MM-DD format it should also work with completion = just for the sake of reference.

1 Like

:thinking: Both queries I suggested work in daily notes (in local test vaults), and your solution is a variation of my second suggestion if the file name uses a file title in the YYYY-MM-DD format. :+1: Good you have a solution.

For anyone else reading this thread who has a similar need:

> [!NOTE] Task
> - [x] This is the task. It is in a daily note in `YYYY-MM-DD` format. And it has a completion date for today > [completion::2024-06-04]

==And these three queries all run:==

## 1. WHERE completion =

WHERE completion =

## 2. WHERE completion = date(

WHERE completion = date(

## 3. WHERE completion = date(today)

WHERE completion = date(today)

1 Like

Thank you.

I do normally post the finished solution. My bad :slight_smile: