- 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 - WEEKDAY function
Description
Returns a number identifying the day of the week of a date.
Syntax
WEEKDAY (<date>, [<return_type>])
Parameters
Sr.No. | Parameter & Description |
---|---|
1 |
date A date in datetime format. |
2 |
return_type Optional. A number that determines the return value − 1 - Week begins on Sunday (1) and ends on Saturday (7), numbered 1 through 7. 2 - Week begins on Monday (1) and ends on Sunday (7), numbered 1 through 7. 3 - Week begins on Monday (0) and ends on Sunday (6), numbered 0 through 6. If omitted, default is 1. |
Return Value
An integer from 0 to 7, based on the return type.
Remarks
The first parameter to the WEEKDAY function is the date of the day. DAX handles the date values in datetime format.
You can specify the date as one of the following −
- Output of another date function.
- An expression that returns a date value.
- A date in a datetime format.
- A date as text representation in one of the accepted string formats for dates.
DAX WEEKDAY function uses the locale and date/time settings of the client computer to understand the text value in order to perform the conversion. For example,
If the current date/time settings represent dates in the format of Month/Day/Year, then the string "1/8/2016" is understood as a datetime value equivalent to 8th January, 2016
If the current date/time settings represent dates in the format of Day/Month/Year, the same string would be understood as a datetime value equivalent to 1st August, 2016.
Example
= WEEKDAY ("1-5-2016") returns 3. = WEEKDAY (TODAY (),2) returns 5. (If today is Friday).