How to make a fiscal calendar in sql

Copper Contributor



On our server, we have a Dim.Calendar table which contains, fulldate (ex: 2020-07-28), dateskey (20200728), dayoftheweek (sunday=1) ,fiscal week number (vary between 1 and 5), fiscalweekstartdate (2020-01-01, firstday of the year, usually it is a sunday), fiscalweekenddate (2020-01-04, a saturday), fiscal period(ex; 202001) , fiscalweekname(ex: 2020-01-w1 until 2020-01-w5 for January).


Unfortunately, our dim.calendar goes to 2025-12-31


Does someone can propose me a sql script to reproduce this dim.calendar table let's say from 2010 to 2050
The fiscal year start the first day of the year, end the last day of the year and we have the following number of fiscalweek per month


jan 5

feb 4

mar 4

april 5

may 4

june 4

july 5

aug 4

sept 4

oct 5

nov 4

dec 4

thank in advance for your help




0 Replies