Please take a look at this Community post, and let us know if you still have questions. This post goes into some of the nuances that accompany this question. For example: do you want to exclude Holiday? Does your data include or exclude weekends? And it gives suggestions for multiple ways of tackling this.
Thanks for using Tableau!
Thank you for you response,
The responses I am getting are different ways of calculating total business days in a month, what I want is a calculated field showing , for example 1st business day in June was on the first and in July it was on the 3rd, these 2 dates are the first business days and I want to compare them on the line graph, so irregardless of the calendar day I should be able to pull the business day and compare say the 5 th business day in May against the 5th business day in June and 5th business day in July. The calculations I am getting from the blog are Measures, I do not need that I dates such as the calendar dates I have on the attached except I will be counting just the business days
1 of 1 people found this helpful
The best way I can think of doing this is to utilize the calculation for number of business days. The use is going to calculate the number of business days from the start of the month to the date field in question. So, your example of Jun 3 would calculate the number of business days between Jun 1 and Jun 3... 2. Which is the desired result. This calculation is:
DATEDIFF("weekday", DATETRUNC('month', [Order Date]), [Order Date])
- 2 * (DATEPART('week', [Order Date]) -DATEPART('week', DATETRUNC('month', [Order Date])))
+ (IF DATENAME('weekday',[Order Date]) = 'Saturday' OR DATENAME('weekday',DATETRUNC('month', [Order Date])) = 'Sunday'
THEN 0 ELSE 1 END)
Note: this is from the attached workbook using Superstore, simply replace the [Order Date] with whichever date field you want to convert.
Thank you Asher this worked for me!!!