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

Convert text to date

Hello,

 

I had searched if anybody already had a similar problem but unfortunately I did not find the right solution.

Actually I thought this should be simple but I am not able to solve the problem.

I have a text field, for example 20221201 and would like to convert it to a date by selecting date as a data type. Unfortunately it does not allow me to do that.

I would like to show the date as 01.12.2022

Does anybody have a idea? Thanks a ton in advance.

CheersUnbenannt.PNG

1 ACCEPTED SOLUTION
Mikelytics
Resident Rockstar
Resident Rockstar

Hi @BINoob0815 

 

Please create in Power Query a custom column with the following formula:

 

Date.FromText([Datum Lieferung], [Format="yyyyMMdd", Culture="de-DE"])

 

Date.FromText - PowerQuery M | Microsoft Learn

 

Best regards

Michael

-----------------------------------------------------

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

@ me in replies or I'll lose your thread.

-----------------------------------------------------

LinkedIn

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

View solution in original post

3 REPLIES 3
BINoob0815
Frequent Visitor

Thank you both! This was very helpful.

v-stephen-msft
Community Support
Community Support

Hi @BINoob0815 ,

 

Here's the solution using DAX.

Date = DATE(LEFT([Datum Liefung],4),LEFT(RIGHT([Datum Liefung],4),2),RIGHT([Datum Liefung],2))

vstephenmsft_0-1670399348657.png

 

Best Regards,

Stephen Tao

 

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

 

Mikelytics
Resident Rockstar
Resident Rockstar

Hi @BINoob0815 

 

Please create in Power Query a custom column with the following formula:

 

Date.FromText([Datum Lieferung], [Format="yyyyMMdd", Culture="de-DE"])

 

Date.FromText - PowerQuery M | Microsoft Learn

 

Best regards

Michael

-----------------------------------------------------

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

@ me in replies or I'll lose your thread.

-----------------------------------------------------

LinkedIn

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

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.