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
Kurumi0418
Helper I
Helper I

TXT to DATE

 

Hi all.

 

How can I do this as blow :

 

use "20180731" to DATE????

 

"20180731"  is stipe, but I want change to DATE time.

 

Thanks.

1 ACCEPTED SOLUTION

@Kurumi0418

 

As a calculated column, you could use

 

Calculated Column =
DATE ( LEFT ( Table1[Column], 4 ), MID ( Table1[Column], 5, 2 ), RIGHT ( Table1[Column], 2 ) )

txttodate.png


Regards
Zubair

Please try my custom visuals

View solution in original post

5 REPLIES 5
GilbertQ
Super User
Super User

Hi there, do you mean you want to take the txt and change it so that it is shown as a date?

 

If so, you can go into the Power Query Editor and change the column from text or number to date, and it should convert it for you automatically.





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

Proud to be a Super User!







Power BI Blog

Anonymous
Not applicable

I think this is the best way but it must be a text, Power Query won't convert directly from number to date.

@Anonymous 

It does convert automatically. Give it a try.

 

Prateek Raina

Anonymous
Not applicable

I have tried right now. This is the error:

DataFormat.Error: No se pudo convertir a Date.
Detalles:
    20050701

Using Adventure Works DW Database, Table FactInternetSales, Column OrderDateKey. If I convert from integer to Date I get the error, but I can do it in two steps: Integer -> Text -> Date

 

 

@Kurumi0418

 

As a calculated column, you could use

 

Calculated Column =
DATE ( LEFT ( Table1[Column], 4 ), MID ( Table1[Column], 5, 2 ), RIGHT ( Table1[Column], 2 ) )

txttodate.png


Regards
Zubair

Please try my custom visuals

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.