Week-based calendars are used in many companies as their fiscal calendars. The total weeks in a fiscal year is 52 weeks, that is, 364 days. Each quarter has 13 weeks. There are 3 varieties of 13 weeks: 5-4-4, 4-5-4 and 4-4-5 weeks per quarter. In leap years, there are 53 weeks or 371 days. IRS has created special code for the 52-53-week fiscal years.
Each company's week-based fiscal calendar will differ in 4 ways:
- define its own start week
- define its own way of placing the leap week
Apple's Fiscal Calendar is widely disseminated on the web. Here we try to clarify some of the misunderstandings and provide calculation assistance in Tableau for analyzing time series based on the 5-4-4 format. We will use Apple's fiscal calendar as an example below.
Common Fiscal Year
In a common year, it's a 52-week year which has 52x7 = 364 days.
A year has 4 quarters and each quarter has 3 fiscal periods/months.
Each quarter has 13 weeks.
At Apple, the first period of a quarter has 5 weeks and the other two have 4 weeks each. It's thus called a 5-4-4 calendar.
First Week of a Fiscal Year
For a week-based calendar, it is very important to understand the definition of its first week. Each company may have a different definition of the first week.
For Apple's fiscal calendar, its first week is the one that always includes October 1st. This week is the first one of the next fiscal year. For example, the week that includes 10/1/2022 is the first week of fiscal year 2023.
First Day of a Week
In Apple's fiscal calendar it's always a Sunday. There may be other conventions where we need to change the following calculations.
Leap Rule
Every 6 years or so, there will be a leap fiscal year.
A leap fiscal year will have 53 weeks, one more week than the common fiscal year.
The cause of the leap fiscal year is as follows:
- A common fiscal year has 364 days while a common calendar year has 365 days. It is 1 day less than the calendar year. It seems that every 7 years, we need to add a week to the common fiscal year to realign the starting dates of fiscal years. But the 7-year frequency is broken by the leap calendar years because a calendar year doesn't always have 365 days. This makes it a lot less predictable when guessing which year is a leap year.
- A calendar year has its own leap year which has 366 days. This happens on every 4 years on the years divisible by 4 and excluding the years that can be divided by 100 but can't be divided by 400.
Leap Week
In a leap fiscal year, there will be an extra week or a leap week. Where to place it depends on the company. In Apple's fiscal calendar, it's added in the third fiscal month which becomes a 5-week month during a leap fiscal year. That is, we insert the leap week after the 13th week of the fiscal year. Or the 14th week of a leap fiscal year is the leap week.
Placement of the Leap Week
We have an extra week in a leap fiscal year. It is appended to the end of the first fiscal quarter or the 3rd fiscal month/period. Thus, the first fiscal quarter, instead of 5-4-4 quarter and having 13 weeks, it becomes 5-4-5 quarter and having 14 weeks.
How to Determine if a Fiscal Year is a Leap Year?
This is easy. Just find out if October 1st in two consecutive years has a gap of 53 or 52 weeks. If 53 weeks, it is a leap year for sure. So, use this logical formula:
The First Day of a Fiscal Year
The Sunday of the first week is the first day of the fiscal year.
In Tableau formula, we can easily derive the first day of a fiscal year. For example for the fiscal year 2023, the first day is:
DATETRUNC('week', MAKEDATE(FiscYear-1,10,1))
The Last Day of a Fiscal Year
DATETRUNC('week', MAKEDATE(FiscYear,10,1))-1
Convert a Date to Fiscal Year/Quarter/Month/Week?
- What fiscal week is it in? We got FiscWeek which is dependent on Order Date and FiscYear.
- What fiscal month (period) is it in? We got FiscMonth which is dependent on FiscWeek and Leap Year T|F. (Credit Steve Fenn)
- What fiscal quarter is it in? We got FiscQuarter which is dependent on FiscMonth.
Conclusion
Note that each company may have its own way of defining its week-based fiscal calendar. Hope that this post can give you some ideas for deriving your own specific formula.
Feel free to download this workbook and copy over the formula if you wish. Contact @aleksoft if questions.
No comments:
Post a Comment