How to Calculate Number of Weekdays Between Dates in Tableau

Recently, while analyzing sales order data in Tableau, I needed to determine the number of working days it took for each order to be shipped. Subtracting the order date from the ship date wasn’t enough because it included weekends, which don’t count as business days.

For this, I used calculated fields to remove weekend dates from weekdays and then calculated the number of weekdays between the order and ship dates.

With this, I was able to get the accurate count of business days, which allowed us to track performance and delivery timelines.

In this Tableau tutorial, I will explain the methods to calculate the number of weekdays between dates in Tableau.

Calculate Number of Weekdays Between Dates in Tableau

In Tableau, there are three methods for calculating the number of weekdays between dates.

Count Number of Weekdays Between Two Date Fields in Tableau

In this example, we use the Tableau Superstore dataset to calculate the number of weekdays between the order date and the ship date.

Now, connect the Tableau with the Superstore data set and follow the steps below.

  1. In the Tableau navigation bar, select Analysis -> Create Calculated Field.
Calculate weekdays between two dates in Tableau
  1. Name the calculated field as “Order date Weekday” and enter the formula below. This formula will remove the weekends from the Order date.
IF DATEPART('weekday', [Order Date]) = 1
THEN DATEADD('day', 1, [Order Date])
ELSEIF DATEPART('weekday', [Order Date]) = 7
THEN DATEADD('day', 2, [Order Date])
ELSE [Order Date]
END

This formula shifts weekend dates to weekdays. If the date is Sunday or Saturday, it moves it to Monday; otherwise, it keeps the days count unchanged.

  1. Similarly, create a calculated field “Ship date Weekday” with the formula below to adjust the days to weekdays for the date field Ship date.
IF DATEPART('weekday', [Ship Date]) = 1
THEN DATEADD('day', -2, [Ship Date])
ELSEIF DATEPART('weekday', [Ship Date]) = 7
THEN DATEADD('day', -1, [Ship Date])
ELSE [Ship Date]
END

This formula will check if the ship date is on Saturday or Sunday, and it will move it to Friday.

  1. Now, we will create a calculated field, Order to Shipping Weekdays, that will calculate the weekdays using the above two formula fields.
MIN(
DATEDIFF('day', [Order date Weekday], [Ship Date Weekday])
+ 1
- 2 * DATEDIFF('week', [Order date Weekday], [Ship Date Weekday])
)
  1. To create the chart view, add the Order ID to the Rows.
calculate weekdays in tableau
  1. Add the fields Order date and Ship date to the Text card in the Marks. By default, it will be in year format. Click on ‘Order date’ and select ‘Exact date.’ Then, repeat the same process for ‘Ship date.’
Tableau calculate number of weekdays
  1. To show the number of weekdays between the order date and the ship date, drag the calculated field Order to Shipping Weekdays to the Rows.
Find Number of weekdays between dates in Tableau

Now, on the text table, we can see the number of days calculated between the Order date and the Ship date.

For example, when the Order Date 15-07-2025 is Tuesday, then it stays the same, while the Ship Date 20-07-2025 (Sun) shifts to 18-07-2025 (Fri). The difference is 3 days, plus 1, which equals 4, with no weekends to subtract.

Count Number of Weekdays Each Month for One Date Field

Another use case to find out weekdays in the Tableau date field is to calculate the number of weekdays in each month for one date field.

For example, we need to find out how many working days were available in the current month, to compare sales per business day across months.

Now, follow the steps below to count the number of weekdays each month for one date field.

  1. To create a calculated field, click on the Analysis tab -> Create Calculated Field.
  1. Enter the field label as “Start of Month Date,” then enter the formula below.
DATETRUNC('month', [Order Date])
  1. Create another calculated field with a name “End of Month Date” with a calculation below.
DATEADD('day', -1, DATEADD('month', 1, DATETRUNC('month', [Order Date])))
  1. Now, we will calculate the number of weekdays between the Start of the Month Date and the End of the Month Date.

Create a new calculated field, label it Weekdays in Month, and enter the formula below.

MIN(
    DATEDIFF('day', [Start of Month Date], [End of Month Date])+ 1
    - 2 * DATEDIFF('week', [Start of Month Date], [End of Month Date])
)

This formula counts all days in the month, then subtracts weekends to give only the number of weekdays.

  1. To create the view drag Order Date to the Columns shelf, right-click it, and choose Month.
Find Weekdays for Each Month in Tableau
  1. After this, drag the calculated field, Weekdays in Month, to the Text card in the Marks section. Now, the table will display the number of weekdays for each month.
Calculate weekday for each month in Tableau

This way, we can calculate the number of weekdays for each month in a given date field by following the above steps.

Count Weekdays Excluding Holidays in Tableau

Another use case scenario for calculating the weekdays between dates is to find out the weekdays by excluding the holidays, along with the weekends.

For this, I have created another Excel sheet, Public Holidays, and joined it with the Superstore dataset.

  1. In the data source window, add the Public Holidays data set.
  1. Drag the Sheet1 near the Orders sheet on the canvas.
Weekdays between public holidays in tableau
  1. For the union between data sheets, select Wildcard(automatic) and click OK.
Join data source in tableau
  1. Set up custom join conditions using the conditions below.
    • Join Clause 1: Order Date >= Holiday Date
    • Join Clause 2: Ship Date <= Holiday Date
Exclude holidays from weekdays in tableau

With this, we have set a join between the two data sheets.

  1. Now, create a calculated field Order Date weekday to shift its days to a weekday.
IF DATEPART('weekday', [Order Date]) = 1 THEN DATEADD('day', 1, [Order Date])
ELSEIF DATEPART('weekday', [Order Date]) = 7 THEN DATEADD('day', 2, [Order Date])
ELSE [Order Date] END
  1. Create a calculated field, Ship Date weekday, to shift the days of the ship date to weekdays.
IF DATEPART('weekday', [Ship Date]) = 1 THEN DATEADD('day', -2, [Ship Date])
ELSEIF DATEPART('weekday', [Ship Date]) = 7 THEN DATEADD('day', -1, [Ship Date])
ELSE [Ship Date] END
  1. Now, we will create a calculation using the above two formula fields to show the final calculation that will show the number of days between the order date and the ship date.
MIN(
    DATEDIFF('day', [Order Date (shifted to weekday)], [Ship Date (shifted to weekday)])
    + 1
    - 2 * DATEDIFF('week', [Order Date (shifted to weekday)], [Ship Date (shifted to weekday)])
) - COUNTD([Holiday Date])
  1. Now drag the Order ID, original Ship Date, and Order Date to Rows.
  1. To show the number of weekdays excluding holidays and weekends, drag the calculated field Holiday Weekday to the text card in the Marks section.
Calculate weekdays excluding holidays

This way, we can calculate the number of weekdays between dates in Tableau by excluding the holidays.

Conclusion

In this Tableau tutorial, we have learned different ways to calculate weekdays in Tableau. We first learned how to find the number of weekdays between two date fields, then learned how to count weekdays in each month.

In the last example, we learned how to exclude holidays along with weekends. Using these methods, you can make Tableau reports more accurate according to business requirements.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.