sql-bi / DaxDateTemplate

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

enhancement, Swedish "Midsummer Eve" #9

Closed joadske closed 5 years ago

joadske commented 6 years ago

Hi, is it possible to add calculations for Swedish Midsummer Eve In Excel its calculated as: Midsummer Eve = DATE(B1;6;19+(7-WEEKDAY(DATE(B1;6;20)))) Midsummer Day= DATE(B1;6;19+(7-WEEKDAY(DATE(B1;6;19)))) Where B1 is the year

joadske commented 6 years ago

This works... Add Sweden SE, and make a new category ex 98 ... { "SE"; 98; 0; 0; 0; "Midsommarafton"; 0; 50 }; --Swedish Midsummer Eve ... And in: VAR HolidayDate = ..... [MonthNumber] = 99; -- Easter offset EasterDate + [DayNumber]; [MonthNumber] = 98; -- Swedish Midsummer Eve DATE ( HolidayYear; 6; 19+(7-WEEKDAY(DATE(HolidayYear;6;20)))); [WeekDayNumber] <> 0; ......

marcosqlbi commented 5 years ago

Do you have an article to a formal definition? I would like to implement a better technique that does not rely on a special MonthNumber considering that there are no related dates. Thanks!

joadske commented 5 years ago

On Swedish wikipedia https://sv.wikipedia.org/wiki/Midsommar_i_Sverige Midsummer in Sweden is since 1953 on a Saturday between 20 and 26 June. Previously, Midsummer Day always occurred on June 24. And Midsummer Eve is on Friday before.

So the calculations I did it only correct on years after 1953

I only needed this to calculate working days on upcoming yers so that way I didn't include yers before 1953.

marcosqlbi commented 5 years ago

Can you try this version: https://github.com/sql-bi/DaxDateTemplate/blob/master/DAX%20Date%20Template.pbix I included the calculation of Midsummer day, so the Midsummer Eve is the day before. I included an holiday calendar for Sweden, too. If it works, I will publish a new version. Thanks!

joadske commented 5 years ago

Thanks, that works fine.

Maybe change the 26/12 to "Boxing Day" or something other than "Christmas day”

Or du you want the Swedish translations?

Happy New Year

/Johan

-- Johan Sent with Airmail

On 27 December 2018 at 11:33:03, Marco Russo (notifications@github.com) wrote:

Can you try this version: https://github.com/sql-bi/DaxDateTemplate/blob/master/DAX%20Date%20Template.pbix I included the calculation of Midsummer day, so the Midsummer Eve is the day before. I included an holiday calendar for Sweden, too. If it works, I will publish a new version. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sql-bi/DaxDateTemplate/issues/9#issuecomment-450125303, or mute the thread https://github.com/notifications/unsubscribe-auth/AovYRuiuzOTFAPiULSvnJ106Dh8s4wWtks5u9KHegaJpZM4WM3Yu .

marcosqlbi commented 5 years ago

Fixed in 1.07a (updated on www.sqlbi.com too). Thanks!