DateDiffWorkdays
EAZYBI Returns the number of working days (by default excluding Saturday and Sunday) from the first date to the second date.
Syntax
DateDiffWorkdays(From_Date_Expression, To_Date_Expression)
or
DateDiffWorkdays(From_Date_Expression, To_Date_Expression, Non_Work_Days_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, 7 for Sunday). If not specified, then If Time dimension options are specified, then these Time dimension non-working days will be used (in this case, please do not specify this argument). |
Examples
Calculate workdays between the issue created and resolved dates
The following example shows how many working days passed from the issue creation date until it was resolved (resolution day is not included). To ensure that the result is displayed as an integer or decimal, use the measure formatting #,### Integer
or #,###.00 Decimal
DateDiffWorkdays( [Issue].CurrentHierarchyMember.Get('Created at'), [Issue].CurrentHierarchyMember.Get('Resolved at') )
Workdays between dates with custom non-working days
The same example returns the difference in working days from the Issue created date until resolution if non-working days are Friday and Saturday. To ensure that the result is displayed as an integer or decimal, use the measure formatting #,### Integer
or #,###.00 Decimal
DateDiffWorkdays( [Issue].CurrentHierarchyMember.Get('Created at'), [Issue].CurrentHierarchyMember.Get('Resolved at'), '56' )
Workdays in current month
Calculate how many workdays are in the current month, the "Current Month" is a calulcated member in the "Time" dimension. To ensure that the result is displayed as an integer use the measure formatting #,### Integer
DateDiffWorkdays( [Time].[Current month].StartDate, [Time].[Current month].NextStartDate )
See also
- Function DateDiffDays() which returns a number of days between two dates.