Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
alihijazi
Helper I
Helper I

what's wrong with adding the below column?

hello

I'm trying to add a column called Year which is gotten from a date column called Date check below:

weird.png

 

However when I click OK I get that the YEAR is not recognized!!

weird_2.png

 

Please advise

2 ACCEPTED SOLUTIONS
alexpancakes
Microsoft Employee
Microsoft Employee

Hi. You are in a Power Query editor (where you can edit the data from sources before loading it).

There you need to user Power Query (M) language.

 

So you have 2 ways to create Year.

1) In Power Query editor use = Date.Year([Date])

2) load data (home - close & load), then create a new column using DAX - there you can use formula you tried (sorry for russian):

year.png

View solution in original post

That is because you are using a wrong syntax.

I will rename your Date column in question to SalesDate, the correct formula will be: Date.Year([SalesDate])

 

For more info, these are the date functions that you can use in M

https://msdn.microsoft.com/en-us/library/mt296606.aspx

View solution in original post

4 REPLIES 4
alexpancakes
Microsoft Employee
Microsoft Employee

Hi. You are in a Power Query editor (where you can edit the data from sources before loading it).

There you need to user Power Query (M) language.

 

So you have 2 ways to create Year.

1) In Power Query editor use = Date.Year([Date])

2) load data (home - close & load), then create a new column using DAX - there you can use formula you tried (sorry for russian):

year.png

got the below error; it didn't work for me!

weird_3.png

 

Please advise

That is because you are using a wrong syntax.

I will rename your Date column in question to SalesDate, the correct formula will be: Date.Year([SalesDate])

 

For more info, these are the date functions that you can use in M

https://msdn.microsoft.com/en-us/library/mt296606.aspx

SabineOussi
Skilled Sharer
Skilled Sharer

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.