Dataview sorting date issue

I am trying to sort a dataview table by the date I started a project (based on a a format “date-started::YYYY-MM-DD” and am using the following dataview code, but it does not seem to be sorting correctly.

dataview
TABLE banner as Cover, artist as Artist, keywords as Keywords, stage as Stage, status as Status, related-courses as "Related Courses", date-started as "Date Started", date-finished as "date Finished"
WHERE contains(type, [[Research Projects]])
WHERE contains(stage, "#04-Idea-Question") OR contains(stage, "#05-Notes") AND !contains(stage, "#07-On-Hold")
SORT stage, ASC
SORT date-started, DESC

I have three projects with the date-started fields as follows: 2021-12-01, 2022-04-11, 2020-10-21.

In the dataview table they appear in the order 2020-10-21, 2021-12-01, 2022-04-11 regardless of what I have the date-started sort set to.

1 Like

You need to remove the comma. There’s no comma in sort command:

...
SORT date-started DESC

thanks so much! Also, how can I best have it sort by one quality than the other. I noticed that now that the dates are working, it sorts by dates but I want it to sort by stages and then by dates

SORT stage ASC, date-started DESC

or

...
SORT stage ASC
SORT date-started DESC

https://blacksmithgu.github.io/obsidian-dataview/query/queries/#sort

Thanks! I was doing that, but I think I must have entered something wrong. It is all working now :slight_smile:

1 Like

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