Forum Discussion

rlymer's avatar
rlymer
Frequent Visitor
3 years ago
Solved

DataFormat.Error: We couldn't parse the input provided as a DateTime value

Hi,   I have a Dataflow that has been working for nearly a year now, but is now throwing the error "DataFormat.Error: We couldn't parse the input provided as a DateTime value.   Details: 2021-10-...
  • edhans's avatar
    3 years ago

    That is a DateTimeZone format. You will need to use DateTimeZone for the field type, then click on Change Type again and change to DateTime and make sure it adds a step, not replaces.

     

    You will have two change type steps. 

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ1NNA1MgwxNLQyNbcyMNM2NLYyMFCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type datetimezone}}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"Column1", type datetime}})
    in
        #"Changed Type1"

     

    How to use M code provided in a blank query:
    1) In Power Query, select New Source, then Blank Query
    2) On the Home ribbon, select "Advanced Editor" button
    3) Remove everything you see, then paste the M code I've given you in that box.
    4) Press Done
    5) See this article if you need help using this M code in your model.