How to Calculate Weekends in Tableau

By: Eric Parker

Eric Parker lives in Seattle and has been teaching Tableau and Alteryx since 2014. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email. You can also sign up for a Tableau Office Hour to work with him directly!

Do you need to create a calculation in Tableau which differentiates between weekends and weekdays?

Maybe you want to provide the field as a filter or use it in a visualization like below.

If that’s the case, look no further! The video below demonstrates how you can use the DATEPART() function to create a weekend calculation. For the code behind the calculation, skip down past the video.

Weekend Calculation Code:

IF DATEPART('weekday',[Date]) = 1 OR DATEPART('weekday',[Date]) = 7

THEN "Weekend"

ELSE "Weekday"

END

Want to keep up with the latest Tableau trends? Subscribe to our YouTube channel and join us for one of our upcoming events!

Tableau Relationships vs. Joins - Webinar Recording

Compare to Equivalent Day Last Year in Tableau

0