Power BI: How to Extract Year from Date


You can use the following syntax in DAX to extract the year from a date in Power BI:

year = YEAR('my_data'[Date]) 

This particular example creates a new column named year that extracts the year from the date in the Date column of the table named my_data.

The following example shows how to use this syntax in practice.

Example: How to Extract Year from Date in Power BI

Suppose we have the following table named my_data in Power BI that contains information about total sales made by some company on various dates:

Suppose that we would like to extract the year from each date in the Date column.

To do so, click the Table tools tab, then click the icon called New column:

Then type the following formula into the formula bar:

year = YEAR('my_data'[Date])

This will create a new column named year that contains only the year from the the corresponding date in the Date column:

For example:

  • The formula extracts 2022 from Saturday, January 1, 2022.
  • The formula extracts 2022 from Wednesday, January 5, 2022.
  • The formula extracts 2023 from Wednesday, February 15, 2023.

And so on.

Note: You can find the complete documentation for the YEAR function in DAX here.

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

Power BI: How to Convert Date to Text
Power BI: How to Get Day of Week from Date
Power BI: How to Convert Date to Month and Year Format

Leave a Reply

Your email address will not be published. Required fields are marked *