DateDiffWorkHours
EAZYBI Returns the number of working hours from the first date to the second date.
Syntax
DateDiffWorkHours( From_Date_Expression, To_Date_Expression, Non_Work_Days_String, Business_Hours_String )
Arguments
From_Date_Expression | MDX expression that returns the first date of the calculation. If the first date is a workday, it will be included in the calculation. |
---|---|
To_Date_Expression | MDX expression that returns the second date of the calculation. Date until which to count workdays; this day itself will be excluded from the result. |
Non_Work_Days_String | Specify a string with non-working day numbers (use 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, 6 for Saturday, and 7 for Sunday). If Time dimension options are specified, then you can use the argument 'default' to take into account these Time dimension non-working days. |
Business_Hours_String | Specify a string with business hours (start and end) in 24-h clock time or 12-h clock time. |
Examples
The following example returns a difference in workhours from the Issue created date until resolution if non-working days are Friday and Saturday and working hours are defined from 9 am to 5 pm (incl). That means if the event happened at 5:59 pm it would still be included.
DateDiffWorkHours( [Issue].CurrentHierarchyMember.Get('Created at'), [Issue].CurrentHierarchyMember.Get('Resolved at'), '56', '9-17' )
The next example will use the default holiday scheme defined for the Time dimension options to calculate the difference in workhours from the Issue created date until resolution and working hours are defined from 8:30 am to 5:30 pm
DateDiffWorkHours( [Issue].CurrentHierarchyMember.Get('Created at'), [Issue].CurrentHierarchyMember.Get('Resolved at'), 'default', '8:30-17:30' )
See also
- Function DateDiffDays which returns the number of days between two dates.
- Function DateDiffWorkdays which returns the number of workdays between two dates.