Date.WeekOfMonth is a Power Query M function that returns a number from 1 to 6 indicating which week of the month the date dateTime falls in.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Date.WeekOfMonth( dateTime as any, optional firstDayOfWeek as nullable number, ) as nullable number
|dateTime||A date, datetime or datetimezone value.|
|firstDayOfWeek||optional||The Day.Type specifies the starting day of the week. If not explicitly specified, the function defaults to Day.Sunday, aligning with regional week-start norms. It accepts values representing each day:|
– Day.Sunday (0) for Sunday,
– Day.Monday (1) for Monday,
– Day.Tuesday (2) for Tuesday,
– Day.Wednesday (3) for Wednesday,
– Day.Thursday (4) for Thursday,
– Day.Friday (5) for Friday,
– Day.Saturday (6) for Saturday.
Returns a number from 1 to 6 indicating which week of the month the date
dateTime falls in.
datetimevalue for which the week-of-the-month is determined.
Determine which week of March the 15th falls on in 2011.
// Output: 3 Date.WeekOfMonth( #date( 2011, 03, 15 ) )
Learn more about Date.WeekOfMonth in the following articles:
- Create Date Table or Calendar in Power Query M
Learn how to create a dynamic calendar table in Power Query’s M language. Build your custom columns and claim your free Date Table Script. » Read more
Other functions related to Date.WeekOfMonth are: