Skip navigation

Add Days of Week to Datediff Function

score 29
You have not voted. Active

I've recently seen a number of questions on the forum that require the number of a particular day of the week between two dates, for example the number of Sundays, weekend days or weekdays. Most solutions I've seen to these problems require nested if statements, modulo, integer division or other acrobatics. Not to mention a whole page of explanation as to how the formula was derived. It seems like there could be a more elegant solution provided within Tableau, such as datediff('sunday', [Date1], [Date2]) to return the number of Sundays between two dates. Datediff('weekday', [Date1], [Date2]) and Datediff('weekend', [Date1], [Date2]) could function similarly.

 

List of Holidays may not be automated as they depend on country / regional variation.

Some People follow lunar calendar and holiday dates vary every year.

 

I added a separate idea for the holidays, workdays and custom date lists here:

http://community.tableau.com/ideas/4434

Comments

Vote history