Forum Discussion

BINoob0815's avatar
BINoob0815
Frequent Visitor
3 years ago
Solved

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.

Cheers

  • 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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BINoob0815 ,

     

    Here's the solution using DAX.

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

     

    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's avatar
    Mikelytics
    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