WEEKNUM

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.

Syntax

WEEKNUM (<date>, <return_type>)

Parameters

TermDefinition
dateThe date in datetime format.
return_typeA 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: 1, week begins on Sunday. Weekdays are numbered 1 through 7.

Return type: 2, week begins on Monday. Weekdays are numbered 1 through 7.

Return value

An integer number.

Remarks

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.

Example

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

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

Example

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

=WEEKNUM('Employees'[HireDate])  

See also

Date and time functions
YEARFRAC function
WEEKDAY function

***** Related Blog Posts *****
60 Page DAX Formula Reference Guide Download Now Available
Show Only Top Or Bottom Results Using Ranking Formula Techniques – Power BI & DAX

***** Related Video Tutorials *****
Ultimate Beginners Guide to DAX

What Is DAX? & Why Do You Need To Learn It – (1.2) Ultimate Beginner Guide to DAX
Formula Syntax, Comments & Variables – (1.6) Ultimate Beginners Guide to DAX
Examples Of Advanced DAX – (1.18) Ultimate Beginners Guide to DAX

***** Related Course Modules *****
Ultimate Beginners Guide to DAX
Mastering DAX Calculations
Solving Analytical Scenarios w/ Power BI and DAX
DAX Formula Deep Dives
Advanced DAX Combinations

***** Related Support Forum Posts*****
Mastering DAX Calculations: What Is DAX?
Understanding DAX Formula
Developing Complex Dax functions
Data Types And Operators