Articles in this section
Category / Section

How to exclude weekend from date column in Bold BI?

Published:

In this article, we will learn how to exclude weekend (Saturdays and Sundays) from a date column using an expression.

Steps to Exclude Weekends from a Date Column:

1. Use the following expression to exclude Sundays and Saturdays from the date column:


SQL Server:
IF(DATENAME(WEEKDAY, [BirthDate]) = 'Sunday' OR DATENAME(WEEKDAY, [BirthDate]) = 'Saturday', NULL, [BirthDate])

MySQL, PostgreSQL:
IF(DATENAME(day, [BirthDate]) = 'Sunday' OR DATENAME(day, [BirthDate]) = 'Saturday', NULL, [BirthDate])

Replace [BirthDate] with the name of your date column.

2. The resulting date field will not have weekend days (Saturdays and Sundays).


We can apply the same expression to remove any day from the date column, by specifying the day name.

Related Articles:

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
PK
Written by Poovarasan Kandasamy
Updated:
Comments (0)
Please  to leave a comment
Access denied
Access denied