How to Calculate Changing Working Days in a Month in Tableau

Working day are usually Monday through Friday excluding public holidays. Calculating the number of working days spent is often useful for in business analytics for a variety of indicators since most businesses do not work on weekends.

Below are steps to create a dynamic working days calculation, that changes daily.

Step 1: Create data source
This could be a Comma-separated values file (.csv) or Microsoft Excel spreadsheets (.xls) with at least 2 columns to hold the day, month and year as a date and the number of working days as an integer.

Data source in xls or csv
Data source in xls or csv

Step 2: Connect to this data source in Tableau
Create a table with your date and the number of working days

Step 3: Create a calculated field
I like to call this Dynamic Working days

Formula

Alternatively,

This is adapted from https://www.theinformationlab.co.uk/2017/05/22/calculate-working-days-dates-tableau by Ian Baldwin

Step 4: Verify
Drag Dynamic working days into the row shelf to verify that the number of working days past is correct for the current month.

Step 5: Save

It is important to note that this only works as long as your data source has the relevant date in it. This means that you will need to update your number of working day occasionally to keep it up to day. The number of working days in a month is difficult to automate because holidays vary across dates and countries. To use this in other calculations, you may need to put this within an INT function.

You can create a blend relationship with any data sources provided that also has a date column or columns

***
Liked this post? Do share it on your social media wall, timeline or feed
Want blog updates and promotions in your inbox
Sign Up Now

Say something...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.