Sort duration

Things I have tried

Hello,

I shortly changed to obsidian, but maybe I have trivial problem.

I try to sort some files by their duration in days.
But my SORT wont be executed.

Here my dataview-code

TABLE   (dat-end - dat-beg).days AS Dauer
WHERE Mus-type = "SA"
SORT Dauer DESC

thats what I get:

how can I get it to this, that Dauer is sorted DESC

What I’m trying to do

SORT Dauer DESC

“Dauer” is the column title, not the field or the “alias” of the field. Because that you can’t use SORT Dauer DESC because Dauer doesn’t exist as a field.

To solve this you have two ways:

  1. You can repeat the duration calculation: SORT (dat-end - dat-beg).days DESC

  2. You can use a trick with the flatten command to “build” a new variable named “Dauer”:

TABLE Dauer
WHERE Mus-type = "SA"
FLATTEN (dat-end - dat-beg).days AS Dauer
SORT Dauer DESC
1 Like

Aahhh… works excellent.
Thank you very much @mnvwvnm,
thinking issue of mine,
well, I have so much to learn… :wink:

best regards

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