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
chahineatallah
Helper III
Helper III

transforming text to date gives error

hello, i have a folder with .txt files, as usual i do from data then from folder

 

so both text files are combined, in text file i have dates which are imported as text data type, when in power query i try to change data type to Date type, some are changed others are giving error, cant figure out what is the issue

 

Annotation 2020-12-17 152007.jpg

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @chahineatallah 

The screenshot of your regional settings shows that your date format is d/m/y.

 

This screenshot shows that the data you are importing is in m/d/y format

mdy-format.png

 

To import these dates correctly what you need to do is Change the date using Locale.

 

Right-click on the column header and then on Change Type -> Using Locale

using-locale.png

 

Then choose Data Type -> Date and Locale -> English (United States)

uslocale.png

 

Click OK and you should be done.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

8 REPLIES 8
chahineatallah
Helper III
Helper III

Thanks, local was useful 👍

PhilipTreacy
Super User
Super User

Hi @chahineatallah 

The screenshot of your regional settings shows that your date format is d/m/y.

 

This screenshot shows that the data you are importing is in m/d/y format

mdy-format.png

 

To import these dates correctly what you need to do is Change the date using Locale.

 

Right-click on the column header and then on Change Type -> Using Locale

using-locale.png

 

Then choose Data Type -> Date and Locale -> English (United States)

uslocale.png

 

Click OK and you should be done.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


chahineatallah
Helper III
Helper III

Annotation 2020-12-17 164629.jpg

chahineatallah
Helper III
Helper III

Hi this is the error message

Also some sample data which is a .txt file , so the date when its imported to power query and i press in the column to change type to date, some dates are changed while others show error

 

Date Sales Product
1/2/18 3 Carlota
1/5/18 2 Carlota
1/7/18 25 Carlota

 

Annotation 2020-12-17 160012.jpg

@chahineatallah , what is your system date setting , 1/15 is fine. Is System date setting is UK /AUS/IND format ?

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
amitchandak
Super User
Super User

@chahineatallah , Click on the error and share that. Also share some sample data

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
chahineatallah
Helper III
Helper III

nope its month day and year

amitchandak
Super User
Super User

@chahineatallah , Are you dates is in DD/MM/YYYY format. If so you need to have following setting

https://community.powerbi.com/t5/Desktop/How-to-apply-UK-date-format-dd-mm-yyyy-in-Date-slicer/td-p/...

 

 

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Solution Authors
Top Kudoed Authors