cancel
Showing results for 
Search instead for 
Did you mean: 
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

Accepted Solutions
Super User III
Super User III

Re: TXT to 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

Try my new Power BI game Cross the River

View solution in original post

5 REPLIES 5
Super User IV
Super User IV

Re: TXT to DATE

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

Re: TXT to 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

Try my new Power BI game Cross the River

View solution in original post

SPG Resolver IV
Resolver IV

Re: TXT to DATE

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

prateekraina Memorable Member
Memorable Member

Re: TXT to DATE

@SPG 

It does convert automatically. Give it a try.

 

Prateek Raina

SPG Resolver IV
Resolver IV

Re: TXT to DATE

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

 

 

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors