Forum Discussion

Alkhos's avatar
Alkhos
Advocate I
9 years ago
Solved

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

Hello,

 

I am working with a dataset retrieved as a CSV file through web.

I have a time field on the dataset with values similar to below:

         10/31/2016 4:05:00 PM

 

When data is fed to PBI desktop, it is automatically detected as "text".

When I attempt to change its type to Date/Time, I get the following error:

 

       DataFormat.Error: We couldn't parse the input provided as a DateTime value.
       Details:
       10/31/2016 6:25:00 PM

 

I have checked the source, all values are similarly formatted ( no add values in the time field )

I have also used PromoteHeaders to prmote the first row ( which contains header to the header field ) before trying to change the type.

 

The exact step that fails uses this DAX code:

 

         #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"time", type datetime}}),

 

Is there anything that I am doing wrong? or do I need any further pre-processing on this time field to be able to properly parse it?

 

Thanks

Ali

 

  • After playing with your text file for 15 mins, I have found that there are some extra space at the front of your date column. Can you please remove those extra characters. 

     

    Steps to follow afterwards:

    1. Split the column by 11 characters. This will separate Date and Time

    2. Split the Date column by "/" Delimiter

    3. Change the data type of the newly created columns to Whole number

    4. Bring the Day column first by dragging, Month column second and Year column last

    5. Select all these three collumns and go to Add column Tab, Select Merge Columns and in Merge dialog, Select "/"Separator.

    6. Change the data type of the merged column to Date.

     

    So many steps .....

     

     

     

34 Replies