DAX Date & Time - DAY function


Advertisements

Description

Returns the day of the month, a number from 1 to 31.

Syntax

DAY (<date>) 

Parameters

Sr.No. Parameter & Description
1

date

A date in datetime format or a text representation of a date.

Return Value

An integer indicating the day of the month.

Remarks

The argument to the DAY function is the Date of the day. DAX handles the date values in datetime format.

You can specify Date as one of the following −

  • An output of another date function.

  • An expression that returns a date.

  • A date in a datetime format.

  • A date as text representation in one of the accepted string formats for dates.

The DAY 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 and the function returns 8.

  • 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, and the function returns 1.

Example

= DAY ("8-Jan") returns 8. 
= DAY ("3/5/2016") returns 5. 
= DAY ("March 5, 2016") returns 5. 
= DAY (TODAY ()) returns 16 if TODAY () returns 12/16/2016 12:00:00 AM. 
= DAY ([Date]) returns a calculated column with day values. 
dax_functions_date_time.htm

Useful Video Courses


Video

Mastering DAX and Data Models in Power BI Desktop

53 Lectures 5.5 hours

Abhay Gadiya

Video

Mastering DAX Studio

Featured

24 Lectures 2 hours

Randy Minder

Video

DAX / Power BI - Customer and Sales Analysis Deep Dive

26 Lectures 4.5 hours

Randy Minder

Advertisements