Forum Discussion

shanezer's avatar
shanezer
Frequent Visitor
2 years ago
Solved

Date in two formats

Hi, I have folders coming in but for some reason it is reading some a different way. I have changed them to text and tried to put a new column in but doesnt work. One when I change it to text is fine...
  • dufoq3's avatar
    2 years ago

    Hi shanezer, check this:

     

    Before

     

    After

    let
        Source = Table.FromList({"23/05/2023", "20240518"}, (x)=> {x}, {"Date"}),
        TransformedDate = Table.TransformColumns(Source, {{"Date", each if Text.Contains(_, "/") then Date.FromText(_, [Format="dd/MM/yyyy"]) else Date.From(_, "en-GB"), type date}})
    in
        TransformedDate