YEAR DAX Function (Date and Time)
Returns the year of a date as a four digit integer.
Syntax
Parameter | Attributes | Description |
---|---|---|
Date |
A date in datetime format. |
Return values
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.
» 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:
-
DAX limitations with inactive relationships and row-level security (RLS)
When you apply row-level security to a semantic model, there are limitations in using the USERELATIONSHIP function. This article shows the issues, provides a workaround, and its restrictions. » Read more
-
Using weekly calendars in Power BI
This article describes why week-based calendars (like 4-4-5) are important for specific industries and how to use them effectively in Power BI. » Read more
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