Date.WeekOfMonth

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

Returns a number from 1 to 6 indicating which week of the month the date dateTime falls in.

  • dateTime: A datetime value for which the week-of-the-month is determined.

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 Youtube Channel

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-weekofmonth
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.