Sorting is DESC instead of ASC?

What I’m trying to do

I’ve been using the following dataview block to keep a list of the pages I’d worked on at what date during a month (which uses a Property called ‘Entries’ that contains links to the daily pages related to the page in question). It’d been working great up until now, but for some reason now it displays them in reverse order…? And I can’t figure out why

TABLE WITHOUT ID
"<span style=color:ebcb8b;>< " + display(Moo) + " ></span>" AS Date,
Page
WHERE contains(file.frontmatter.Entries, "-06-2025")
FLATTEN Entries AS Moo
FLATTEN file.link as Page
SORT Moo ASC

The above is the ‘new’ script, adapted for June. The only difference with the previous is that the previous said “-05-2025” instead of “-06-2025”, and that really should be the only difference because I copy-pasted it and then changed the number in the string. But just in case, here is the block for last month:

TABLE WITHOUT ID
"<span style=color:ebcb8b;>< " + display(Moo) + " ></span>" AS Date,
Page
WHERE contains(file.frontmatter.Entries, "-05-2025")
FLATTEN Entries AS Moo
FLATTEN file.link as Page
SORT Moo ASC

Above is the block for the month of May.

Now, June currently displays like this:

Even though May displayed like this:

(Don’t mind the dates from other months, it’s due to the fact that some pages have dates from several different months in the Entries property. I don’t like it, but it’s a different problem from the one I’m trying to solve here)

I started using this block in April, and it worked fine for April, just like it does for May. I don’t understand why it’s suddenly displaying things in the wrong order for June…

Things I have tried

Not sure how to search for this on the forum. Didn’t really find anything. At any rate, I tried using DESC instead of ASC, and it reversed the order just fine…? (Note that I’m not sure why it correctly sorts the dates as if they were dates, because as I said they are links to pages, and in the April page for instance I’ll have all the dates for April come before the ones for May, despite some of them starting with larger numbers, like having April 27 come before May 5th and the like)

So…For some reason it thinks that [[07-06-2025]] comes before [[03-06-2025]], and I don’t understand why. I don’t really know what to even try, considering it worked fine for the previous two months…Anybody got an idea of what the issue could be?..

Perhaps the exact syntax of the Entries field changed? I guess it could be useful to see an example of the yaml front matter of some notes, showing how Entries are formatted.

You can “turn” your Entries links into dates in the query. Then you won’t have to guess about the order of the strings, and it opens up all the date characteristics for you to work with for sorting and filtering.

Try this, which makes each of your Moos a date called D, filters for June 2025 Ds, and sorts on D:

TABLE WITHOUT ID
	"<span style=color:ebcb8b;>< " + dateformat(D, "dd-MM-yyyy") + " ></span>" AS Date,
	file.link AS Page
FLATTEN Entries AS E
FLATTEN date(display(E), "dd-MM-yyyy") AS D
WHERE D.year = 2025 AND D.month = 6
SORT D ASC

Remove or edit the WHERE, and you should see that this works across years and months.

1 Like

While I still don’t understand why the original one stopped working, your version does seem to work! Ty very much!! (On top of that I think you also solved my other problem that I wasn’t expecting to find a quick solution for, since you are filtering through D instead of the files directly :D)

1 Like

Sorry for the extra notification, but I wanted to add that the solution code made things really laggy, but simply re-adding the line that checks for the contents of the Entries property solved it. It does mean that there are two places to edit when creating the table for a new month, however it’s well worth the optimization imo (if I’m not hallucinating the speed improvement)

In case it isn’t clear I’m talking about this line: WHERE contains(file.frontmatter.Entries, "-06-2025")

Totally. It was just an example of the versatility of using a date, where you’re not restricted to one month, and you could do math and comparisons with it.

With your original month-and-year line in again, you can remove WHERE D.year = 2025 AND D.month = 6, as they do the same thing. That could speed you up some more. And bring you back to only place to edit.