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
im_92
Frequent Visitor

Convert text to date

Hi all, 

 

I am trying to convert a text column to a date format. 

The original column contains the date in this format: wednesday 2 october 2018. 
I want to have a column with the date in this format: 02-10-2018

 

Any suggestions? 

thanks 

 

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

If you split the column by the first instance of a space, i.e. getting rid of the day of the week, does that get it into a close enough format that it can automatically recognise it's a date?

View solution in original post

4 REPLIES 4
jthomson
Solution Sage
Solution Sage

If you split the column by the first instance of a space, i.e. getting rid of the day of the week, does that get it into a close enough format that it can automatically recognise it's a date?

that worked! Thanks! 

@im_92   The explanation that @jthomson provided is the simpler way of what I posted.

 

Use a text delimiter of a space to remove the day of week and then you can format as a date.  

 

Job done.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Daviejoe
Memorable Member
Memorable Member

This should work, the bold text can be added after your source code

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKk9NyUstTkmsVDBSyE8uyU9KLVIwMjC0UIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}}),
#"Inserted Text After Delimiter" = Table.AddColumn(#"Changed Type", "Text After Delimiter", each Text.AfterDelimiter([Date], " "), type text),
#"Changed Type1" = Table.TransformColumnTypes(#"Inserted Text After Delimiter",{{"Text After Delimiter", type date}})
in
#"Changed Type1"





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.