Its quite amusing to see that there are no direct way to calculate working days in Webi or most of the reporting tools. We need to do some workarounds to perform this. I found a way to do this (not optimal though) when we just have to remove the Saturdays and Sundays from two date ranges and calculate the date difference. However, I have made an assumption here that the minimum day difference is at least 7 days between the 2 dates. Here are the steps,
1. Calculate days difference using the simple formula
=DaysBetween([Start_Date];[End_Date])
Keep this as [Day_Diff]
2. Calculate the Mod as below,
=Mod([Day_Diff];7)
The formula will give the reminder and what ever is the result is the number of days left out when we try to convert the number of days in to weeks. Name this variable as [Mod]
3. For a whole week of 7 days, we will definitely have 2 holidays (1 Saturday and 1 Sunday). So use the below formula to calculate absolute number of Saturdays and Sundays for the whole week.
=(([Day_Diff] – [Mod]) / 7) * 2
Name this as [Round_Weeks]
4. Create another Variable – [Day_Name], this will use the formula – DayName([Incident Resolved Datetime]). Basically this variable will contain the Day Name of the date when the record was resolved.
5.Now comes an interesting part, what we need to identify is for the remaining of the days (the result of Mod variable) are we having any Saturdays or Sundays. Use the below variable for this. Name this as [Final_Removal]
=If [Day_Name] = “Monday” And [Mod] = 1 Then 0
ElseIf [Day_Name] = “Monday”And [Mod] = 2 Then 1
ElseIf [Day_Name] = “Monday” And [Mod] = 3 Then 2
ElseIf [Day_Name] = “Monday” And [Mod] = 4 Then 2
ElseIf [Day_Name] = “Monday” And [Mod] = 5 Then 2
ElseIf [Day_Name] = “Monday” And [Mod] = 6 Then 2
ElseIf [Day_Name] = “Tuesday” And [Mod] = 1 Then 0
ElseIf [Day_Name] = “Tuesday” And [Mod] = 2 Then 0
ElseIf [Day_Name] = “Tuesday” And [Mod] = 3 Then 1
ElseIf [Day_Name] = “Tuesday” And [Mod] = 4 Then 2
ElseIf [Day_Name] = “Tuesday” And [Mod] = 5 Then 2
ElseIf [Day_Name] = “Tuesday” And [Mod] = 6 Then 2
ElseIf [Day_Name] = “Wednesday” And [Mod] = 1 Then 0
ElseIf [Day_Name] = “Wednesday” And [Mod] = 2 Then 0
ElseIf [Day_Name] = “Wednesday” And [Mod] = 3 Then 0
ElseIf [Day_Name] = “Wednesday” And [Mod] = 4 Then 1
ElseIf [Day_Name] = “Wednesday” And [Mod] = 5 Then 2
ElseIf [Day_Name] = “Wednesday” And [Mod] = 6 Then 2
ElseIf [Day_Name] = “Thursday” And [Mod] = 1 Then 0
ElseIf [Day_Name] = “Thursday” And [Mod] = 2 Then 0
ElseIf [Day_Name] = “Thursday” And [Mod] = 3 Then 0
ElseIf [Day_Name] = “Thursday” And [Mod] = 4 Then 0
ElseIf [Day_Name] = “Thursday” And [Mod] = 5 Then 1
ElseIf [Day_Name] = “Thursday” And [Mod] = 6 Then 2
ElseIf [Day_Name] = “Friday” And [Mod] = 1 Then 0
ElseIf [Day_Name] = “Friday” And [Mod] = 2 Then 0
ElseIf [Day_Name] = “Friday” And [Mod] = 3 Then 0
ElseIf [Day_Name] = “Friday” And [Mod] = 4 Then 0
ElseIf [Day_Name] = “Friday” And [Mod] = 5 Then 0
ElseIf [Day_Name] = “Friday” And [Mod] = 6 Then 1
ElseIf [Day_Name] = “Saturday” And [Mod] = 1 Then 1
ElseIf [Day_Name] = “Saturday” And [Mod] = 2 Then 1
ElseIf [Day_Name] = “Saturday” And [Mod] = 3 Then 1
ElseIf [Day_Name] = “Saturday” And [Mod] = 4 Then 1
ElseIf [Day_Name] = “Saturday” And [Mod] = 5 Then 1
ElseIf [Day_Name] = “Saturday” And [Mod] = 6 Then 1
ElseIf [Day_Name] = “Sunday” And [Mod] = 1 Then 1
ElseIf [Day_Name] = “Sunday” And [Mod] = 2 Then 2
ElseIf [Day_Name] = “Sunday” And [Mod] = 3 Then 2
ElseIf [Day_Name] = “Sunday” And [Mod] = 4 Then 2
ElseIf [Day_Name] = “Sunday” And [Mod] = 5 Then 2
ElseIf [Day_Name] = “Sunday” And [Mod] = 6 Then 2
6. Final work days calculation will be below,
=[Day_Diff] – [Round_Weeks] – [Final_Removal]
Hope this helps, if you find any flaws in this approach, please let me know. I have tested for a few values and it looks to be working fine!!!!
P.S: I used this concept to find the working days between a service record create date and resolve date.