Forum Discussion

Mr_Stern's avatar
Mr_Stern
Frequent Visitor
2 years ago
Solved

date format from numbers

Hi,  I have dates that import from the data as numbers in the form of yyyymmdd. When I transform to dates it obviously gives an error. I've tried various ways of transforming the information into a...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Mr_Stern ,

     

    Thanks for the reply from rajendraongole1 .

     

    Here is the sample data I created:

    Date

    20181212

    20201008

    20210305

    20220608

    20231115

    20240520

     

    Check in Power Query that the column is formatted as Text.

     

    Add a custom column:

    Date.FromText(Text.Start([Date], 4) & "-" & Text.Middle([Date], 4, 2) & "-" & Text.End([Date], 2))

     

    Check whether the format of the custom column is Date. In this case, the Date format is mm/dd/yyyy.

     

    Exit Power Query.

     

    There are two ways to change the format of the custom column to dd/mm/yyyy.

     

    1. Change directly on the tab.

     

    1. Create a measure:
    Formatted Date = FORMAT(MAX('Table'[Custom]), "dd/mm/yyyy")

     

    The page effect is as shown below:

     

    If you have any other questions, please feel free to contact me.

     

    The pbix file is attached.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!