cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sarvesh23p
New Member

Convert Date from text data type to Date data type

Hi All,

 

I have imported a data from Kaggle and having issue in converting a Date column from text data type to Date data type.

I can split the column and get the reqired data but need to undertsand how to solve this problem.

Below is the Screen shot of the records.

 

sarvesh23p_0-1662989941493.png

 

1 ACCEPTED SOLUTION
yingyinr
Community Support
Community Support

Hi @sarvesh23p ,

Did you get any error message when change the data type for date column? As you can see the below gif, it can display normally when change the data type of date column as Date type....

Date/time types

change to date type.gifAnd you can create a calculated column as below to get a date type column and delete the original date column...

 

Ndate = DATE ( LEFT ( 'Table'[date], 4 ), MID ( 'Table'[date], 5, 2 ), RIGHT ( 'Table'[date], 2 ) )

 

yingyinr_0-1663051468454.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
yingyinr
Community Support
Community Support

Hi  @sarvesh23p ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
yingyinr
Community Support
Community Support

Hi @sarvesh23p ,

Did you get any error message when change the data type for date column? As you can see the below gif, it can display normally when change the data type of date column as Date type....

Date/time types

change to date type.gifAnd you can create a calculated column as below to get a date type column and delete the original date column...

 

Ndate = DATE ( LEFT ( 'Table'[date], 4 ), MID ( 'Table'[date], 5, 2 ), RIGHT ( 'Table'[date], 2 ) )

 

yingyinr_0-1663051468454.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hoangechip910
Frequent Visitor

Hi

I think, your text-type column shoul be in form of date (such as yyyy/mm/dd, mm-dd-yyyy,...) to power bi can understand and convert it to Date type. In your case ,you should insert  Forward slash "/" to seperate year/month/day. Then you can convert it to date type.

You can do that in Power Query by Sample Columns function, or InsertText.

 

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power BI Dev Camp Session 27

Ted's Dev Camp

This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.