OpenBI Docs Buy

YEAR

The year of a date, as a whole number such as 2026.

Group: Date and time. Compatible with DAX.

Syntax

YEAR ( <date> )
ParameterTypeDescription
dateDateA 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] ) = 2026 keeps 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 ) )
YearMonthDayOf a number
20243152023

Liters by year

EVALUATE
ROW (
    "2024", CALCULATE ( [Liters sold], YEAR ( Sales[Month] ) = 2024 ),
    "2025", CALCULATE ( [Liters sold], YEAR ( Sales[Month] ) = 2025 )
)
20242025
586171603353

MONTH, DAY, QUARTER, DATE, YEARFRAC.

Last updated · OpenBI Studio 0.3.74