DateTime DAX Data type


DAX stores dates as a DateTime data type. This format uses a floating-point number internally, wherein the integer corresponds to the number of days since December 30, 1899, and the decimal part identifies the fraction of the day. Hours, minutes, and seconds are converted to decimal fractions of a day. Thus, the following expression returns the current date plus one day (exactly 24 hours):

 = TODAY () + 1

The result is the date of tomorrow, at the time of the evaluation. If one only needs to take the date part of a DateTime, they should use INT or TRUNC to get rid of the decimal part.
In Power BI, the user interface shows two additional data types: Date and Time. However, they are both stored as DateTime. In fact, Date and Time only show the integer or the decimal part of the DateTime, respectively.

The first date officially supported by DAX is March 1, 1900. Date calculations executed on time periods prior to that date might lead to errors and should be considered as inaccurate.

A DateTime value can be specified as a literal by using the prefix dt before a string with one of the following formats:

  • dt”YYYY-MM-DD”
  • dt”YYYY-MM-DDThh:mm:ss”
  • dt”YYYY-MM-DD hh:mm:ss”

For example, DATE ( 2023, 5, 19 ) corresponds to dt”2023-05-19″.

Last update: May 6, 2023   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber, Sergio Murru

2018-2024 © 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.

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 DateTime? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.