Date.WeekOfYear

The function will output a number between 1 and 54 to represent the week of the year for a given date and time value. The date and time value provided will be used to determine the week of the year. A...

Syntax

Date.WeekOfYear(dateTime as any, optional firstDayOfWeek as nullable number) as nullable number

About

The function will output a number between 1 and 54 to represent the week of the year for a given date and time value. The date and time value provided will be used to determine the week of the year. An optional value for the first day of the week can be specified as Day.Type, indicating the starting day of the week (such as Day.Sunday). If not specified, a default value based on the culture will be used.

Explanation

To identify the week in the year that includes March 27th, 2011, utilize the Power Query MDate.WeekOfYear function. When executed with the date parameter set to March 27th, 2011, the output will be Week 14. If the analysis is conducted with Monday designated as the beginning of the week, the output will be Week 13.