WEEKNUM

Updated on

WEEKNUM is a DAX function that returns the week number in the year for a given date.

Syntax

WEEKNUM(
   Date,
   ReturnType
)
Argument Properties Description
Date A date in datetime format.
ReturnType Optional A number that determines the return value: use 1 when week begins on Sunday, or use 2 when week begins on Monday.

Return Values

An integer number.

Remarks

  • 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 if return_type is any valid value other than 21, for any 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.

  • For return_type, the following valid values may not be supported by some DirectQuery data sources:

    return_type Week begins on System
    1 or omitted Sunday 1
    2 Monday 1
    11 Monday 1
    12 Tuesday 1
    13 Wednesday 1
    14 Thursday 1
    15 Friday 1
    16 Saturday 1
    17 Sunday 1
    21 Monday 2

Example 1

The following example returns the week number for February 14, 2010. This calculation assumes weeks begin on Monday.

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

Example 2

The following example returns the week number of the date stored in the column, HireDate, from the table, Employees. This calculation assumes weeks begin on Sunday.

= WEEKNUM('Employees'[HireDate])

Other functions related to WEEKNUM are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/weeknum-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy