diff --git a/src/Dax.Template/Tables/Dates/HolidaysTable.cs b/src/Dax.Template/Tables/Dates/HolidaysTable.cs index d6c0dd3..4731a41 100644 --- a/src/Dax.Template/Tables/Dates/HolidaysTable.cs +++ b/src/Dax.Template/Tables/Dates/HolidaysTable.cs @@ -152,15 +152,15 @@ public HolidaysTable(IHolidaysConfig config): base(config) ERROR ( ""Wrong configuration in {config.HolidaysDefinitionTable}"" ) ) ) ) ) ) ) ) // ) - VAR __HolidayDay = WEEKDAY ( __HolidayDate, 1 ) - 1 + VAR __HolidayDay = WEEKDAY ( __HolidayDate, 1 ) VAR __SubstituteHolidayOffset = // SWITCH ( // TRUE, IF ( '{config.HolidaysDefinitionTable}'[SubstituteHoliday] = -1, SWITCH ( __HolidayDay, - 0, 1, -- If it falls on a Sunday then it is observed on Monday - 6, -1, -- If it falls on a Saturday then it is observed on Friday + 1, 1, -- If it falls on a Sunday then it is observed on Monday + 7, -1, -- If it falls on a Saturday then it is observed on Friday 0 ), IF ( '{config.HolidaysDefinitionTable}'[SubstituteHoliday] > 0 @@ -259,7 +259,7 @@ RETURN ROW ( VAR _SubstituteOffsetStep1 = [@SubstituteHolidayOffset] + _ConflictDay0 + _ConflictDay1 + _ConflictDay2 VAR _HolidayDateStep1 = _CurrentHolidayDate + _SubstituteOffsetStep1 VAR _HolidayDayStep1 = - WEEKDAY ( _HolidayDateStep1, 1 ) - 1 + WEEKDAY ( _HolidayDateStep1, 1 ) VAR _SubstituteHolidayOffsetNonWorkingDays = IF ( NOT CONTAINS ( __WorkingDays, ''[Value], _HolidayDayStep1 ), @@ -274,7 +274,7 @@ NOT CONTAINS ( __WorkingDays, ''[Value], _HolidayDayStep1 ), MINX ( __WorkingDays, ''[Value] ) + 7, _NextWorkingDayStep2 ) - RETURN _SubstituteDay - _HolidayDateStep1 + RETURN _SubstituteDay - _HolidayDayStep1 ) VAR _SubstituteOffsetStep2 = _SubstituteOffsetStep1 + _SubstituteHolidayOffsetNonWorkingDays VAR _SubstituteDateStep2 = _OriginalSubstituteDate + _SubstituteOffsetStep2