sql-bi / DaxTemplate

Tabular and DAX template engine
MIT License
16 stars 4 forks source link

Fix SubstituteHoliday to match WorkingDays range [2..6] #49

Closed albertospelta closed 5 months ago

albertospelta commented 5 months ago

Fixes an issue where the calculated substitute holiday day is incorrect when FridayIfSaturdayOrMondayIfSunday (-1) is used. Repro: year 2022 or 2023, config { "US", 12, 25, 0, 0, 0, "Christmas Day", -1, 100, 0, 0 }

This patch aims for preserving backward compatibility instead of breaking the current configuration value { 2, 3, 4, 5, 6 }, which is used in multiple date templates.

A change to the documentation is also required here: https://docs.sqlbi.com/dax-template/configuration/config-object/holidays#workingdays to update the statement "The weekdays are expressed by integer numbers where Sunday is 0" where Sunday should be 1 instead of 0.

albertospelta commented 5 months ago

Fixes https://github.com/sql-bi/Bravo/issues/555 and https://github.com/sql-bi/Bravo/issues/576