Reputation: 728
I have a requirement to do % of (Workdays till date) / (Total Workdays of the month). How can I create a "Calculated field" for this logic. I don't need to consider holidays or any sort. Any help is highly appreciated.
Upvotes: 0
Views: 795
Reputation: 1967
A quick google search turned up this: http://kb.tableau.com/articles/knowledgebase/calculating-the-number-of-business-days
In the Calculated Field dialog box, do the following and then click OK: Name the calculated field. In the example workbook, the calculated field is named Number of Weekdays. In the formula field, create a calculated field similar to the following:
DATEDIFF("weekday", [Start Date], [End Date]) - 2 * (DATEPART('week', [End Date]) -DATEPART('week', [Start Date])) + (IF DATENAME('weekday',[End Date]) = 'Saturday' OR DATENAME('weekday',[Start Date]) = 'Sunday' THEN 0 ELSE 1 END)
In your example you take the difference between the first and the last of a month and calculate the working days by subtracting 2 * [number of weeks]
for the weekends. Once you have that value you can easily create the ratio you wanted.
Upvotes: 1