TODAY DAX Function (Date and Time) Volatile
Returns the current date in datetime format.
Syntax
This expression has no parameters.
Return values
Current date.
Remarks
The time returned is always 12:00:00 AM and only the date is updated.
The result of the TODAY function changes only when the column that contains the formula is refreshed. It is not updated continuously.
The NOW function returns also the current time.
» 3 related functions
Examples
-- TODAY returns today, as a date. NOW also includes the time -- UTCTODAY and UTCNOW return today using UTC standard. -- The timezone is the timezone of the server running DAX, your -- PC when executed in Power BI Desktop. -- -- The Power BI Service alwyas uses UTC. -- Therefore, no daylight saving applies. -- -- Keep in mind that DAX.do caches query results, so you will not see -- an updated result if you try this query without making any change. EVALUATE { ( "TODAY", TODAY () ), ( "UTCTODAY", UTCTODAY () ), ( "NOW", NOW () ), ( "UTC NOW", UTCNOW () ) }
Value1 | Value2 |
---|---|
TODAY | 2021-02-26 00:00:00 |
UTCTODAY | 2021-02-26 00:00:00 |
NOW | 2021-02-26 10:31:35.75 |
UTC NOW | 2021-02-26 10:31:35.75 |
-- Compute the difference in days and hours between -- current time zone and UTC. EVALUATE VAR DaysFromUTC = INT ( TODAY () - UTCTODAY () ) VAR HoursFromUTC = ( NOW () - UTCNOW () ) * 24 RETURN { ( "Days from UTC: ", DaysFromUTC ), ( "Hours from UTC: ", HoursFromUTC) }
-- Example of using math over dates to compute -- the age of the customers -- by subtracting from TODAY the order date -- -- Keep in mind that DAX.do caches query results, so you will not see -- an updated result if you try this query without making any change. EVALUATE ADDCOLUMNS ( TOPN ( 10, ALL ( Customer[Name], Customer[Birth Date] ) ), "Customer Age", VAR Age = TODAY () - Customer[Birth Date] VAR AgeYears = YEAR ( Age ) - 1900 VAR AgeMonths = MONTH ( Age ) RETURN FORMAT ( AgeYears, "0" ) & " years and " & FORMAT ( AgeMonths, "0" ) & " months" ) ORDER BY Customer[Birth Date] DESC
Name | Birth Date | Customer Age |
---|---|---|
Anderson, Chloe | 1979-10-25 | 41 years and 5 months |
Russell, Jennifer | 1978-12-18 | 42 years and 3 months |
Xie, Russell | 1978-09-17 | 42 years and 6 months |
Morris, Isabella | 1978-09-07 | 42 years and 6 months |
Carter, Amanda | 1977-10-16 | 43 years and 5 months |
Alexander, Seth | 1977-09-21 | 43 years and 6 months |
Lopez, Sophia | 1977-07-13 | 43 years and 8 months |
Simmons, Nathan | 1976-02-24 | 45 years and 1 months |
Garcia, Joseph | 1975-08-17 | 45 years and 7 months |
Green, Gabriel | 1975-04-05 | 45 years and 11 months |
Related articles
Learn more about TODAY in the following articles:
-
Computing MTD, QTD, YTD in Power BI for the current period
This article describes how to use the DAX time intelligence calculations applied to the latest period available in the data, also known as the “current” period. » Read more
Related functions
Other related functions are:
Last update: Nov 14, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/today-function-dax