6 Replies Latest reply on Nov 10, 2018 7:19 AM by Oyem Badinga

# Working days calculation

Hi Everyone,

I want to get the count of working days between start and end date. I have a date column and I want number of visits done for a location.

I got the number of visits but when calculating the average visits per month, I want to look only working days not weekends.

Example say past october month contains 31 days but i want only working days example 21 not 31 including weekends.

• ###### 1. Re: Working days calculation

Hi Oyem

On date column you have to write a calculation to get only the working days.

Write a calculated field as below

Weekday Name:

DATENAME('weekday',[Date])

Working Days:

{Fixed  [Date]: AVG(if [Weekday Name]='Sunday' then 0

elseif [Weekday Name]='Saturday' then 0

else 1

end)}

Use the same measure and apply the start and end dates for the same and check. This should work properly. If yes then mark this question as answered or let me know what error you are getting.

3 of 3 people found this helpful
• ###### 2. Re: Working days calculation

Hi Oyem,

Please check out this blog post which may help:

Thanks,

Mavis

• ###### 3. Re: Working days calculation

Thank you Akram! It works as expected many thanks!

• ###### 4. Re: Working days calculation

Thank you mavis! This also I tried this link but my LOD expression was wrong! Akram Ebrahim formula worked perfectly

• ###### 5. Re: Working days calculation

The most important part to remember about all the above answers is that this treats Monday-Friday as Business Days and Saturday and Sunday as non-business days.  If that is not true in your location, you will have to modify the calculations to account for the differences.

In addition, these calculations take no account of "bank holidays" or statutory or national holidays, or any other day that would normally be considered a Working Day but isn't for location-specific reasons.  Tableau has no easy way to recognizing that, so if that is important to the data your are analyzing, you'll have to figure out a way to build a calendar that defines your specific holidays.

This is a notoriously tricky problem particularly for organizations that have operations in multiple geographies with completely different holiday calendars.

2 of 2 people found this helpful
• ###### 6. Re: Working days calculation

Hi Michael,

Yes you are correct. Thanks for your input. As of now my client convinced with this working day approach. Ten days in an year is not a big issue.