Dataview query, why no sort?

What I’m trying to do

I have a list of projects and I would like to create a table where I sort those that are finished by their finish date.
Here’s an example of the data. The data are trivial, just for the sake of illustration.

projPriority:: Buy a new car
projDone:: Go to the Mall
(projFinished:: 2023-01-27)
projPriority:: Buy flowers
projPriority:: Go to the park
projDone:: Walk the dog
(projFinished:: 2023-01-18)

Things I have tried

My dataview query is:

TABLE without ID projdone AS "Finished Projects", projfinished AS "Date finished" from "Notes" where file.name = this.file.name
sort projfinished asc

It shows to projects that are finished, but the sort order is wrong. I expected “Walk the dog” first and then “Go to the Mall.”

You could use tasks:

- [x] Buy a new car  
- [x] Go to the mall (completion:: 2023-01-27)  
- [ ] Buy flowers  
- [ ] Go to the park ✅ 2023-03-07
- [x] Walk the dog (completion:: 2023-01-18)
***
## tasks marked as completed
```dataview
TASK
WHERE
	completed
	AND
	file.name = this.file.name
SORT
	completion 
	ASC
```
***
## tasks with a completion date but not necessarily marked as completed
```dataview
TASK
WHERE
	completion
	AND
	file.name = this.file.name
SORT
	completion 
	ASC
```


https://blacksmithgu.github.io/obsidian-dataview/annotation/metadata-tasks/

Thank you! A nice and simple solution. I was overthinking the whole matter.

1 Like

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