Date.WeekOfMonth

Updated on

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

Syntax

Date.WeekOfMonth(
   dateTime as any,
   optional firstDayOfWeek as nullable number,
) as nullable number
ArgumentAttributeDescription
dateTimeA date, datetime or datetimezone value.
firstDayOfWeekoptionalThe 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.

Description

For a provided datetime value (dateTime), Date.WeekOfMonth returns a number from 1 to 6. This number indicates which week of the month dateTime falls into.

Examples

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:

Other functions related to Date.WeekOfMonth are:

BI Gorilla Blog

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-weekofmonth