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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

How to convert date to year ?

Hi All

 

I have Raw data below :-

 

Date

12/2/2020

20/12/2019

 

My excepted result :-

Year,motn,Date

2020,2,12/2/2020

2019.12.2019

 

Hoep some one can advise me.

 

Paul Yeo

9 REPLIES 9
Anonymous
Not applicable

@Anonymous @Pragati11 @Anonymous  @amitchandak 

You Have to create a new column .

Write below formula 

New Date = Format(table1[date], "YYYY.mm.dd")

This code is more efficiant  and let you modify your date as per your requirement .

You will get the desired result .

Give kudos if is it work for you .


Anonymous
Not applicable

@Anonymous Duplicate the date column (twice) in Power Query editor and transform to Year, Month no.. As Power Query supports 2 columns to merge at once, first merge would be on Year and Month no. and next merge will be of resultant column (year,monthno.) with Date.

Please mind the sequence you select the columns to merge.

amitchandak
Super User
Super User

@Anonymous ,

 

year = right([column],4)

 

Month =
var _pos = search("/",[column],,0)
return
mid([column],_pos+1,2)

 

new date =
var _pos = search("/",[column],,0)
return
date(right([column],4), mid([column],_pos+1,2), left([column],_pos-1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi Amit

I get error msg :-

Paulyeo11_0-1601971807134.png

 

Pragati11
Super User
Super User

Hi @Anonymous ,

 

You can create new columns for YEAR and MONTH using DAX as follows:

 

yearCol = YEAR(tablename[Date])

monthCol = MONTH(tablename[Date])

 

Replace tablename[Date] in the above DAX expressions with your table name and date column name.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi Miss ,  Can you share how to start DAX ?

Hi @Anonymous ,

 

You don't have to start DAX. It's in Power BI only. Just see the GIF below on how you can create a dax calculation:

colCreation.gif

 

Check the following link to go through starting with DAX in Power BI:

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-quickstart-learn-dax-basics

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi Miss 

Thank you for sharing the link . Now more lady start to like data visulisation. it use to be for man only.

Paul Yeo

 

@Anonymous That statement would have been inappropriate back in 1960, and it is very inappropriate today. I think you want to apologize to @Pragati11 .

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors