generate_calendar_table_m
Create a calendar table in Power Query M with date, fiscal, and locale columns. Specify start/end dates and optional fiscal month/locale, then refresh.
Instructions
Generate a full date/calendar table as a new query: List.Dates over [startExpr..endExpr] with ~20 part columns (Year, Quarter, QuarterName, MonthNo, MonthName, MonthShort, YearMonthNo, YearMonth, ISOWeek, ISOYear, WeekdayNo, DayName, DayNo, DayOfYear, StartOfMonth, EndOfMonth, IsWeekend). startExpr/endExpr are RAW M, e.g. "#date(2020,1,1)" or a parameter reference. Pass fiscalYearEndMonth (1..12) to add FiscalYear/FiscalMonthNo/FiscalQuarter. Pass locale (e.g. en-NZ) to render month/day names in that culture. Refresh afterwards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| locale | No | locale/culture for month/day names, e.g. en-NZ (optional) | |
| endExpr | Yes | end date as raw M, e.g. #date(2025,12,31) | |
| sessionId | Yes | ||
| startExpr | Yes | start date as raw M, e.g. #date(2020,1,1) | |
| fiscalYearEndMonth | No | fiscal year-end month 1..12 (optional; adds fiscal columns) |