How to sort multiple columns in Dataview

Things I have tried

What I’m trying to do

I wish to sort multiple columns for table in Dataview query. However it doesn’t allow me to do that. E.g.:

SORT [Field 1] asc, [Field 2] asc

The result doesn’t show a table that sorts column [Field 1] and [Field 2] simultaneously.

Did I miss anything? Thanks!

Well, how table works? There’s a relation between columns and rows: in the “row 1” you see related values in column A, column B, etc…
So, if you sort by column A, all the values in the same row changes position accordingly.
You can’t change the “horizontal” relation between values.
What you can do? Let’s say you sort by column A and, in some cases, you have the same values in column A and you want to sort these (a kind of a second level of sort for equal values in level one) by column B… well, in this cases you can do this:
SORT columnA ASC, columnB ASC
https://blacksmithgu.github.io/obsidian-dataview/query/queries/#sort

5 Likes

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