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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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 ?

amitchandak
Super User
Super User

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

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/...

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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