DATEVALUE DAX Function (Date and Time)

Converts a date in the form of text to a date in datetime format.

Syntax

DATEVALUE ( <DateText> )
Parameter Attributes Description
DateText

A text string that represents a date.

Return values

Scalar A single datetime value.

A date in datetime format.

Remarks

DATEVALUE uses the locale of the model to read DateText. For example, if the locale shows dates as month/day/year, “1/8/2009” returns January 8, 2009. If the locale shows dates as day/month/year, the same string returns August 1, 2009. The application and the computer that create the model define its locale.

If DateText is not valid with the locale of the model, DATEVALUE tries other date formats before it returns an error. Thus, “1/31/2009” returns January 31, 2009 with any locale. Different rows can use different formats. For example, with a month/day/year locale, “5/4/2018” returns May 4, 2018, and “20/4/2018” returns April 20, 2018.

The YYYY-MM-DD format does not depend on the locale. For example, “2020-02-06” returns February 6, 2020.

If DateText does not include the year, DATEVALUE uses the current year. A two-digit year from 0 to 49 is a year from 2000 to 2049, and a two-digit year from 50 to 99 is a year from 1950 to 1999.

DATEVALUE ignores the time part. For example, “2020-02-06 13:45:10” returns February 6, 2020 at midnight. A string with only a time returns December 30, 1899. The ISO format with T before the time, for example “2020-02-06T13:45:10”, returns an error.

If DateText is BLANK, the result is BLANK. An empty string, a string that is not a valid date, or a number, for example DATEVALUE ( 45000 ), returns an error.

You do not need DATEVALUE for a constant date: use a date literal with the dt prefix, for example dt”2020-02-06″. The formats dt”YYYY-MM-DDThh:mm:ss” and dt”YYYY-MM-DD hh:mm:ss” are also valid.

» 1 related function

Examples

--  DATEVALUE/TIMEVALUE convert strings into dates and times
EVALUATE
{
    DATEVALUE ( "10/15/2020" ),
    DATEVALUE ( "10-15-2020" ),
    TIMEVALUE ( "12:45:01" ),
    TIMEVALUE ( "12.45.01 AM" ),
    TIMEVALUE ( "15:45:01 AM" )
}
Value
2020-10-15 00:00:00
2020-10-15 00:00:00
1899-12-30 12:45:01
1899-12-30 00:45:01
1899-12-30 15:45:01
--  If month and day are exchanged, the conversion still works
--  The default is defined by the international settings
EVALUATE
{
    DATEVALUE ( "28/02/2020" ),
    DATEVALUE ( "02/28/2020" ),
    DATEVALUE ( "08/10/2020" ),   -- 10th of August
    DATEVALUE ( "2020-02-06" )
}
Value
2020-02-28
2020-02-28
2020-08-10
2020-02-06

Related functions

Other related functions are:

Last update: Nov 10, 2026   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/en-us/dax/datevalue-function-dax

2018-2026 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Passed by Expression

This parameter is passed by expression and can be evaluated multiple times in different evaluation contexts.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of DATEVALUE? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.