sql-bi / DaxDateTemplate

Power BI template to create a Date table in DAX
MIT License
265 stars 76 forks source link

Need to add Juneteenth to US Holidays #57

Closed HymieHo closed 2 years ago

HymieHo commented 3 years ago

Juneteenth National Independence Day

https://en.wikipedia.org/wiki/Juneteenth#Legal_observance "According to the bill, federal government employees will now get to take the day off every year on June 19, or should the date fall on a Saturday or Sunday, they will get the Monday or Friday closest to the Saturday or Sunday on which the date falls."

HymieHo commented 3 years ago

I created a PR with the changes applied to the PBIX. The DAX is attached to this comment.

DAX Date Template.txt

marcosqlbi commented 2 years ago

I implemented it in v1.15 through a more generic technique that can be applied to any similar holiday. The replaced holiday appears as "(in lieu of Juneteenth)" as for other similar holiday replacements.

HymieHo commented 2 years ago

I knew there was a more elegant solution--thanks. The only issue is that Juneteenth started in 2021 yet this code will show Juneteenth as a holiday in any year. Do we need to add a parameter to HolidayParameters for "start year", -1 for all? As time marches on it will be less important, but especially for 2022 it will be noticed in all "prior year" measures that take working days into account.

marcosqlbi commented 2 years ago

This is now fixed in 1.18. Thanks!