Bases: Sort by either if watched date = year, or if it does not treat rewatched date as watched date and sort all notes accordingly

What I’m trying to do

Hi there, I have my film base in Obsidian. Each film note has a property watched with a date format. Some notes have an additional property with a date rewatched property.

What I would like to do is create a view of a year with all notes watched/rewatched in that particular year. So far I can display both, but only after one another. So I get a list with all notes with a date watched property and then after that a list with all notes with a corresponding rewatched property.

I want one list sorted by new → old.

So I need a formula I guess to optimise the view and create one list.

Something like: If seenOn does not match the year selected, check seenOn2 if that matches treat as seenOn or if not don’t display note.

Things I have tried

Using the Sort by or Sort by Group options. Hereby, I get one list but with the explained variation in the sorting process.

I’m super grateful for any ideas.

I assume you already have a view that filters films based on whether they were watched or rewatched in the past year. In that case, you could apply the following formula in your sort:

if(rewatched > watched, rewatched, watched)

Thanks for your reply. I’ve tried around but can’t seem to make it work.

How exactly do I apply that formula to sort by in the base view?

  1. Create a formula sort by most recent watch and paste the code from above there.

  2. In the base: Select the formula sort by most recent watch in the Sort > Sort by setting.

Feel free to let me know if something isn’t clear.