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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
adam_mac
Helper I
Helper I

Converting text year to date in Power Query

Hi, i am trying to convert column Academic year which has been stored as a text field to a date format. When i do this however it returns 13/07/1905. Any ideas how i can fix this so it shows e.g. 2020 but in date format? 

 

1.PNG2.PNG

1 ACCEPTED SOLUTION
edhans
Super User
Super User

@adam_mac your image shows the 2021 is an integer, and converting an integer to date will give you the erroneous results you show - because Power Query counts days like Excel, and July 13, 1905 is the 2021'st day since Dec 31, 1899.

 

You need to convert it to actual text first, then convert to date by adding a step, not hitting "replace current."

IntegerToDate.gif



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
edhans
Super User
Super User

Glad to help @adam_mac - one of those live and learn things on quirks of Power Query. 😁



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Super User
Super User

@adam_mac your image shows the 2021 is an integer, and converting an integer to date will give you the erroneous results you show - because Power Query counts days like Excel, and July 13, 1905 is the 2021'st day since Dec 31, 1899.

 

You need to convert it to actual text first, then convert to date by adding a step, not hitting "replace current."

IntegerToDate.gif



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

hi @edhans , that worked great. Thank you very much! i have been stuck on that for embarassingly long! 

AlB
Community Champion
Community Champion

Hi @adam_mac 

Just change the type to date in PQ and you should get a date 01/01/2021. Then in the DAX table you can set the format to show only the year (2001 (yyyy)) while keeping the date type. See it all at work in the attached file.

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors