Forum Discussion

ovetteabejuela's avatar
ovetteabejuela
Impactful Individual
5 years ago

Help on Date Format conversion

I have 2 Excel files with a Source that has this Column 'Date' (see below) in my 1 Excel it converts fine but in the other it converts it to Month as Date and Date as month see other image below.

 

This should be March 1, April 1, May 1 and not January 3, 4, 5 ...

 

 

9 Replies

  • ovetteabejuela's avatar
    ovetteabejuela
    Impactful Individual

    By the way I already tried using Locale but it too doesn't work my currect solution is not advisable because if the source will change it's format it will not work... Basically I split this by delimeter and added a custom column with this syntax #date() - this worked but again it's not flexible.

     

    I just can't understand why it worked in another Excel (this was older but the same source) and did not work in my version today.

     

    • CNENFRNL's avatar
      CNENFRNL
      Community Champion

      ovetteabejuela , you may want to try,

      Table.AddColumn(Source, "Custom", each Date.ToText(Date.From([Date]), "MMMM d, yyyy"))

  • Anonymous's avatar
    Anonymous
    Not applicable

    You need to convert the Date Column to Date format before doing Date.ToText. Right now it looks like you are performing a Date Operation on a text column. 
    --Nate

    • ovetteabejuela's avatar
      ovetteabejuela
      Impactful Individual

      Actually that is the very first thing that anyone will do even the system will automatically convert your data after you promote to Headers BUT converting this to date will yeild the same result that is why what your seeing are non-convetional approach.

      Converting immediately (as usual) to date will result to January 3, January 4, January 5..... instead of March 1, April 1 and May 1

  • Anonymous's avatar
    Anonymous
    Not applicable

    ovetteabejuela 

    What is the date format in the original excel file, are both date columns are the same data type and format? Can you show a screen short.

     

    Paul Zheng _ Community Support Team

    • ovetteabejuela's avatar
      ovetteabejuela
      Impactful Individual

      In Excel this is in General Type, and it is basically of type Text

       

      Actual Source Screenshot:

       

      Below, I am showing you how it is translated within Excel environment  and into Power Query.

       

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    ovetteabejuela 

    Date
    8/1/2021
    9/1/2021
    10/1/2021


    With the above sample date column in excel, I get the correct date with either excel connector and enter date feature in Power Query. I cannot reproduce the 1/4/2021 format in the PQ, that turns the April 1st to Jan 4th. 

     

     

    Please try with Power Query in power bi desktop. This problem could be the Excel Power Query.

     

     


    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Have you tried Table.AddColumn(Date.FromText([DATE]))

     

    Date.FromText, instead of ToText?