- DAX Functions Tutorial
- DAX Functions - Home
- DAX Functions - Introduction
- DAX Parameter Naming Conventions
- Description Structure
- DAX Functions - Aggregation
- DAX Functions - Filter
- DAX Functions - Time Intelligence
- DAX Functions - Date and Time
- DAX Functions - Information
- DAX Functions - Logical
- Math & Trigonometric Functions
- DAX Functions - Parent & Child
- DAX Functions - Statistical
- DAX Functions - Text
- DAX Functions - Other
- DAX Functions Useful Resources
- DAX Functions - Quick Guide
- DAX Functions - Useful Resources
- DAX Functions - Discussion
DAX Date & Time - WEEKNUM function
Description
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
Sr.No. | Parameter & Description |
---|---|
1 |
date Date in datetime format. |
2 |
return_type A number that determines the return value − 1 - Week begins on Sunday. Weekdays are numbered 1 through 7. 2 - Week begins on Monday. Weekdays are numbered 1 through 7. If omitted, the default value is 1. |
Return Value
An integer, in the range 1 to 53.
Remarks
DAX uses 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.
Note − 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
= WEEKNUM ("Oct 2, 2016", 1) returns 41. = WEEKNUM ("Dec 31, 2016", 1) returns 53.