Forum Discussion

higgy7's avatar
higgy7
Advocate II
2 years ago
Solved

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

Hi,   I am trying to create a dataflow but at the end I get the We couldn't parse the input provided as a DateTime value. Details Reason = DataFormat.Error Detail = 13/11/2023 02:00:00 error.    ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi higgy7 

     

    Try editing the "Changed column type" step to add the locale information at the end, as highlighted in below code. This should work. 

     

    let
    Source = Folder.Files("\Folder Path\PowerBI Datasources"),
    Navigation = Source{[#"Folder Path" = "\Folder Path\PowerBI Datasources", Name = "DataName.csv"]}[Content],
    #"Imported CSV" = Csv.Document(Navigation, [Delimiter = ",", Columns = 9, Encoding = 65001, QuoteStyle = QuoteStyle.None]),
    #"Promoted headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars = true]),
    #"Changed column type" = Table.TransformColumnTypes(#"Promoted headers", {{"DateTime", type datetime}, {"Name", type text}, {"Country", type text}, {"Location", type text}, {"Type", type text}, {"Remarks", type text}, {"Latitude", type number}, {"Longitude", type number}, {"Precipitation_mm", type number}}, "en-GB"),
    #"Duplicated column" = Table.DuplicateColumn(#"Changed column type", "DateTime", "DateTime - Copy"),
    #"Changed column type 1" = Table.TransformColumnTypes(#"Duplicated column", {{"DateTime", type date}, {"DateTime - Copy", type time}}),
    #"Sorted rows" = Table.Sort(#"Changed column type 1", {{"DateTime", Order.Descending}})
    in
    #"Sorted rows"

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!