Creating a 554 Calendar
Many companies, especially retailers, do not report on calendar months. They use a calendar made of whole weeks instead, such as a 4-4-5 calendar, where each quarter has a month of four weeks, another of four and a last of five.
These calendars differ from company to company in a few ways:
- the month in which the financial year starts
- the day on which each week starts
- how the spare day is handled, because 365 days make 52 weeks with one day left over
This page builds one example, which follows these rules:
- The financial year starts on the Monday closest to 1 January.
- Each quarter’s months have five, four and four weeks, so January has five weeks, February four and March four, and the pattern then repeats.
- Its weeks, months and years are the financial weeks, months and years that the financial data is reported in.
1. Create a list of dates
Section titled “1. Create a list of dates”- Generate a list of dates that starts on the first day of the financial year:
= List.Dates(#date(2019,12,30), 1096, #duration(1,0,0,0))- Convert the list to a table and rename its column Dates.
- Add an index column called ID that starts from 1.

2. Create a Week ID column
Section titled “2. Create a Week ID column”The 5-4-4 pattern repeats every 13 weeks, so each week needs its own number before it can be assigned to a month.
- Add a custom column called WeekID that divides the ID by 7 and rounds up, using Number.RoundUp. Every week in the whole calendar then has its own number.
![The Custom Column dialog creating WeekID with Number.RoundUp([ID]/7)](/_astro/554-calendar-2.BS0NUqge_1YhFAb.webp)
3. Create a Financial Week column
Section titled “3. Create a Financial Week column”- Add a Fin Week column with the formula below, which numbers the weeks from 1 to 52 within each year.

4. Create a Week of Quarter column
Section titled “4. Create a Week of Quarter column”- Add a Week of Quarter column, which counts from 1 to 13 and then starts again.
The formula subtracts a multiple of 13 from the WeekID. In the first 13 weeks it subtracts 0 × 13, so weeks 1 to 13 keep their numbers. In the next 13 weeks it subtracts 1 × 13, so weeks 14 to 26 become 1 to 13 again, and so on for every later quarter.

5. Create a Year ID column
Section titled “5. Create a Year ID column”- Add a YearID column, which is 1 for the first year, 2 for the second and so on. It divides the WeekID by 52 and rounds up, so that each block of 52 weeks gets its own year number.
![The Custom Column dialog creating YearID with Number.RoundUp([WeekID]/52)](/_astro/554-calendar-5.yclFaIf-_Gfgnj.webp)
Week 53 therefore starts the second year, and it also starts on a Monday.
6. Create a Financial Year column
Section titled “6. Create a Financial Year column”Each financial year is named after the calendar year that its middle falls in. A 52-week year is 364 days long, so the middle of the first year is 182 days after the start date, and each later year’s middle is another 364 days on. The formula finds that date and takes its year:
Date.Year(Date.AddDays(#date(2019,12,30), ([YearID] - 1) * 364 + 182))A calendar that starts on 30 December 2019 gives 2020 for its first year, and one that starts on 2 January 2023 gives 2023, so the name is right whether the year starts just before or just after 1 January.
The screenshot shows an earlier, simpler formula, which adds the YearID to the start date’s year. That works only when the year starts in late December, since a start in early January would be named after the following year.
![The Custom Column dialog creating Fin Year as Date.Year(#date(2019,12,30)) + [YearID]](/_astro/554-calendar-6.BgRdDSMy_2gdx0x.webp)
7. Create a Month ID column
Section titled “7. Create a Month ID column”The Week of Quarter column says which month of its quarter a week falls in. Weeks 1 to 5 are in the first month, weeks 6 to 9 in the second and weeks 10 to 13 in the third, and this holds for every quarter.
The MonthID column uses an if statement with one test for each of those three ranges. The number of quarters already completed is the WeekID divided by 13, rounded up, less 1. The formula multiplies that by 3, which gives the number of months already completed, and adds 1, 2 or 3 according to the range the week falls in.

8. Create a Financial Month column
Section titled “8. Create a Financial Month column”- Add a Fin Month column from the MonthID. It works like the Week of Quarter column, but with 12 in place of 13, so it counts from 1 to 12 within each year.

9. Create a Month Name column
Section titled “9. Create a Month Name column”Because this financial year starts in January, the financial month number is the same as the calendar month number, so it can produce the month name directly. The formula builds a date from the year and month, and the day does not matter, because only the month’s name is extracted.

10. Create a Day Name column
Section titled “10. Create a Day Name column”- Finally, add a Day Name column.
![The Custom Column dialog creating Day Name with Date.ToText([Dates], “ddd”)](/_astro/554-calendar-10.BnvjH64I_ZVoh1u.webp)
11. Turn the query into a function
Section titled “11. Turn the query into a function”- In the Queries pane, right-click the query and choose Duplicate.
- Edit the copy so that it becomes a function, as in the code below:
let myCalendar = (YearStartDate as date) => let Source = List.Dates(YearStartDate, 1096, #duration(1,0,0,0) ), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Dates"}}), #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "ID", 1, 1, Int64.Type), #"Added Custom" = Table.AddColumn(#"Added Index", "WeekID", each Number.RoundUp([ID]/7)), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Fin Week", each [WeekID] - (Number.RoundUp([WeekID]/52) - 1) * 52), #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Week of Quarter", each [WeekID] - (Number.RoundUp([WeekID]/13) - 1) * 13), #"Added Custom3" = Table.AddColumn(#"Added Custom2", "YearID", each Number.RoundUp([WeekID]/52)), #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Fin Year", each Date.Year(Date.AddDays(YearStartDate, ([YearID] - 1) * 364 + 182))), #"Added Custom5" = Table.AddColumn(#"Added Custom4", "MonthID", each if ([Week of Quarter] >=1 and [Week of Quarter] <=5) then ((Number.RoundUp([WeekID]/13)-1)*3)+1 else if ([Week of Quarter] >=6 and [Week of Quarter] <=9) then ((Number.RoundUp([WeekID]/13)-1)*3)+2 else if ([Week of Quarter] >=10 and [Week of Quarter] <=13) then ((Number.RoundUp([WeekID]/13)-1)*3)+3 else null), #"Added Custom6" = Table.AddColumn(#"Added Custom5", "Fin Month", each [MonthID] - (Number.RoundUp([MonthID]/12) - 1) * 12), #"Added Custom7" = Table.AddColumn(#"Added Custom6", "Month Name", each Date.ToText(#date([Fin Year], [Fin Month],1), "MMM")), #"Added Custom8" = Table.AddColumn(#"Added Custom7", "Day Name", each Date.ToText([Dates], "ddd")) in #"Added Custom8"in myCalendarOnce the function is saved, the editor shows its parameter box:

Click Invoke, and a dialog asks for the start date.

Enter a start date such as 02/01/2023, which is the Monday closest to 1 January 2023, and click OK. Power Query generates a calendar table of the 1096 days from that date.
12. Make a weekly calendar
Section titled “12. Make a weekly calendar”Each calendar table can also give a weekly calendar with one row per week.
- In the Queries & Connections pane, right-click the calendar query and choose Reference.

- In the new query, filter the Day Name column to keep only Sundays, which are the last day of each week.

Then tidy the result:
- Remove the Day Name column, which no longer tells you anything.
- Rename the Dates column to Week Ending.
- Remove the ID column, which now reads 7, 14, 21 and so on.
The weekly calendar then looks like this:
