YEAR
The year of a date, as a whole number such as 2026.
Group: Date and time. Compatible with DAX.
Syntax
YEAR ( <date> )
| Parameter | Type | Description |
|---|---|---|
date | Date | A date, a date with a time, or text that reads as one. |
Returns
Whole number. The year, 100 to 9999.
Remarks
- A blank date gives BLANK.
- Text is read as a date:
YEAR ( "2024-03-15" )is 2024. A year on its own, "2024", is no date and is an error. - A number is taken as a date number, days from 30 December 1899:
YEAR ( 45000 )is 2023. - As a filter,
YEAR ( Sales[Month] ) = 2026keeps one year's rows.
Examples
The parts of a date
EVALUATE
VAR Day = DATE ( 2024, 3, 15 )
RETURN
ROW ( "Year", YEAR ( Day ), "Month", MONTH ( Day ), "Day", DAY ( Day ), "Of a number", YEAR ( 45000 ) )
| Year | Month | Day | Of a number |
|---|---|---|---|
| 2024 | 3 | 15 | 2023 |
Liters by year
EVALUATE
ROW (
"2024", CALCULATE ( [Liters sold], YEAR ( Sales[Month] ) = 2024 ),
"2025", CALCULATE ( [Liters sold], YEAR ( Sales[Month] ) = 2025 )
)
| 2024 | 2025 |
|---|---|
| 586171 | 603353 |