Marko’s code works for my needs—essentially trying to filter completed tasks into years rather than having a massive long list of all tasks for all years.
Why is it necessary to use contains(text … rather than using the actual key alone? And how should I know to use text in such a situation? I could not work out what to do from reading the Dataview docs. My bad, I know. Just wish I had better logic to know what to do and when to do it. Despite using Dataview for years and having read the docs relentlessly, I still struggle.
I misread your request to sort according to year, not as to limit to that year. For the latter it would be better to do WHERE completion.year = 2024.
If you work with text you’re working with the entire line, which sometimes is useful if the information you want to look at hasn’t been extracted already. But most often it can also be accessed using other means like in this case through the completion date field.
Hehe, the devil is in the details—by accident! I saw this. The word should be completion instead of completed. Then @holroy’s solution works. At least by this: Metadata on Tasks and Lists - Dataview. completed is boolean.
```
- [x] Done [completion:: 2024-04-10]
- [x] Also done [completion:: 2025-04-10]
## completion.year
```dataview
TASK
WHERE file.name = this.file.name
AND completion.year = 2024
LIMIT 50
```
Sorry about that… Marko is very correct that the date field is completion, and completed only is used as a boolean to check whether a task is finished or not. So in all my previous responses, they should’ve used completion.
NB: If you actually use completed as an inline field it might be overwritten by dataview as that is set when rendering. This might also not allow for the completion field to be set correctly. (Which is part of the reason I use the checkmark/emoji to set this date)
Again, @DiCaver and @holroy, many thanks for the help and explanations.
Lost count of the number of times I have read Metadata on Tasks and Lists and seen both completed and completion and failed to register that they were being used differently.
I don’t ever write the completion field / date – when I click the Dataview query to mark the task as complete, Dataview writes the details into the original task automatically. Just seen that I can set the Completion date format in Dataview’s settings. Will change it from completed to ✅ in line with your advice.