Setting a filter and excluding weekends

How do I go about setting a filter that doesn’t include the weekends.

So, it would show what needs to get delivered today, tomorrow, and the next day (2 day look ahead) but exclude (saturday/sunday) if it happens to follow on one of those days.

Hi @Erik_Andersson1 :blush: ,

Depending on your setup and where you want to apply the filter but maybe you could try something like :

thisTable.Filter(Dates.Weekday() != 7 AND Dates.Weekday() != 1)

7 is for Saturday and 1 is for Sunday :blush: (As weeks, here on Coda begins on Sunday)

2 Likes

I am going to share.a document with you, and hopefully that helps and makes it easier to understand what i am trying.

hi @Erik_Andersson1 , hi @Pch ,

this is my contribution; though I could not see the doc (nor did I ask for permission)

The formula takes the next Monday (= weekday) in case of a weekend.

SwitchIf(
thisRow.date.Weekday() = 1,
Date(Today().Year(),ToDay().Month(),thisRow.date.Day()+1),
thisRow.date.Weekday() = 7,
Date(Today().Year(),ToDay().Month(),thisRow.date.Day()+2),
thisRow.date)

cheers, Christiaan

If I understood you right, you want to filter a view to show items due within the next 2 workdays?

There’s an often overlooked formula Workday() that allows you to add X days to a date skipping over weekends and your arbitrary list of holiday dates.

You can then set your filter as this formula:

DueDate >= Today()
AND
DueDate <= Today().Workday(2)

or just the last condition to also include overdue items.

This means, if today’s Monday you’ll get items for Mon, Tue and Wed, but if today’s Friday you’ll get items due on Fri, Mon, and Tue (and also Sat/Sun if there happen to be any).

2 Likes