YEAR DAX Function (Date and Time)

Returns the year of a date as a four digit integer.

Syntax

YEAR ( <Date> )
Parameter Attributes Description
Date

A date in datetime format.

Return values

Scalar A single integer value.

An integer in the range 1900-9999.

Remarks

If the argument is a string, it is translated into a datetime value using the same rules applied by the DATEVALUE function.

» 2 related articles
» 6 related functions

Examples

--  Extract date parts from a date
EVALUATE
ADDCOLUMNS (
    TOPN ( 10, VALUES ( 'Date'[Date] ), 'Date'[Date], ASC ),
    "Year",    YEAR    ( 'Date'[Date] ),     
    "Quarter", QUARTER ( 'Date'[Date] ),
    "Month",   MONTH   ( 'Date'[Date] ),    
    "Day",     DAY     ( 'Date'[Date] )         
)
ORDER BY 'Date'[Date]
Date Year Quarter Month Day
2005-01-01 2,005 1 1 1
2005-01-02 2,005 1 1 2
2005-01-03 2,005 1 1 3
2005-01-04 2,005 1 1 4
2005-01-05 2,005 1 1 5
2005-01-06 2,005 1 1 6
2005-01-07 2,005 1 1 7
2005-01-08 2,005 1 1 8
2005-01-09 2,005 1 1 9
2005-01-10 2,005 1 1 10

Related articles

Learn more about YEAR in the following articles:

Related functions

Other related functions are:

Last update: Dec 4, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/year-function-dax

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 YEAR? 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.