Export (0) Print
Expand All

WEEKNUM Function

Returns the week number for the given date and year according to the return_type value. The week number indicates where the week falls numerically within a year.

WEEKNUM(<date>, <return_type>)

Term

Definition

date

The date in datetime format.

return_type

A number that determines the return value: use 1 when the week begins on Sunday; use 2 when the week begins on Monday. The default is 1.

Return type

Week begins

1

Week begins on Sunday. Weekdays are numbered 1 through 7.

2

Week begins on Monday. Weekdays are numbered 1 through 7.

An integer number.

In contrast to Microsoft Excel, which stores dates as serial numbers, DAX uses a datetime data type to work with dates and times. If the source data is in a different format, DAX implicitly converts the data to datetime to perform calculations.

By default, the WEEKNUM function uses a calendar convention in which the week containing January 1 is considered to be the first week of the year. However, the ISO 8601 calendar standard, widely used in Europe, defines the first week as the one with the majority of days (four or more) falling in the new year. This means that for years in which there are three days or less in the first week of January, the WEEKNUM function returns week numbers that are different from the ISO 8601 definition.

The following example returns the week number of the date February 14, 2010.

=WEEKNUM("Feb 14, 2010", 2)

The following example returns the week number of the date stored in the column, HireDate, from the table, Employees.

=WEEKNUM('Employees'[HireDate])
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft