Mastering Working Day Calculations in Tableau: A Step-by-Step Guide

Blog | August 30, 2024 | By Surendra Sharma

Accurate Working Day Analysis in Tableau

Step-by-Step Guide to Working Day Calculations

Enhancing Data Analysis with Working Days in Tableau

mastering-working-day-calculations-in-tableau-main-image

Accurately determining the number of working days between two dates is something that’s important to most, if not all,  businesses. Besides helping them calculate an important business KPI called ‘Turn Around Time’, calculating working days is also crucial for assessing performance and optimizing workflows.  

While Microsoft Excel offers the NETWORKDAYS function – which calculates number of days between two dates excluding weekends – the same logic is absent in Tableau. Hence for those looking for a comparable solution, we’re offering a step-by-step guide that tackles the intricacies of calculating working days in Tableau.


Introduction to Working Day Calculations in Tableau

Key Steps for Accurate Working Day Calculations

Incorporating Holidays and Weekends in Tableau

Practical Applications of Working Day Calculations

Overview of Working Day Calculation Techniques

Setting Up Your Tableau Environment

Advanced Tips for Complex Scenarios in Tableau

Logic for the calculation 

  • Calculate number of days between two dates.
  • Calculate the number of Saturday and Sunday between two dates.
  • Subtract number of weekends from overall day difference.

Here’s how we can implement this in Tableau

Step 1

Calculate the week difference between start date and end date.

week-difference-start-and-end-date

Step 2

Calculate number of weekends based on date difference in week. If the week difference is 0 then no weekend, else multiply week difference by 2.

Calculate number of weekends based on date difference in week

Step 3

Calculate working days by calculating overall day difference between start date and end date and subtract number of weekends.

Calculate-working-days-by-calculating

Bonus 

What will happen if the start date or end date falls on a weekend. Then we must modify our calculations a bit to consider this scenario. 

Logic to consider weekends as Start or End Date 

If a start date or end date falls on a weekend we will push it to a weekday. 

  • If Start Date falls on Saturday or Sunday push it to Monday. We will call it Start Day (Weekday)
If Start Date falls on Saturday or Sunday push it to Monday
  • If End Date falls on Saturday or Sunday push it to Friday. Call it End Date (Weekday).
  • Then update all our calculation to use these new start date and end date
update-all-our-calculation-to-use-these-new-start-date-two
update-all-our-calculation-to-use-these-new-start-date-three

This will provide you with working days between two dates even if they fall on weekends.

working days between two dates

Calculating working days is a crucial metric for any business to measure performance and make strategic decisions. By following the steps outlined in this guide, you should be able to calculate working days in Tableau easily.  

But while this approach provides a solid foundation, it’s essential to consider your specific business requirements and data characteristics. For instance, you might need to account for holidays or adjust the definition of a workday to suit your organization’s needs. With a thorough understanding of the underlying logic and the flexibility offered by Tableau, you can create tailored calculations to meet your exact analysis objectives.

surendra-sharma
About the Author
Data Analytics expert with 12+ years of experience. Skilled in leveraging various data tools to extract valuable insights from data and design scalable data solutions. Passionate about translating complex data into clear, actionable visual stories.
Surendra SharmaTechnical Lead - Data Value | USEReady