Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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
Solved! Go to Solution.
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 .....
If the problem are the leading spaces, as mentioned by @BhaveshPatel , then you need to right click in the column and select transform>trim
If this works better please remeber to mark it, so others will benefit
You can specify the default format of receiving the data for Date format.
Just add en-GB or en-US in the end in the M code.
it prevents from failing the convertation 🙂
#"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"Date", type date}}, "en-GB")
Hi, the power query editor considers your laptop's default date format so if the data is not in that format it might cause a problem in changing the data type.
Hence, you may split the column by delimiter and add a new column (using add a column from example, considering your system's date format).
I had same error, solution was to check source file and I noticed the bottom cells of the date column was merged and had other data that wasnt dates and could not be formatted as date. Solution was to delete these rows and refresh Power Query and it worked
I faced the same issue. I went back & checked my data sets, I noticed that the date columns were different in 2 of the 6 files.
One needs to double check the data source which is being appended.
data parse is however a more elegant and practical solution as not all the data sources can be manipulated and after a while you may decide to change data source.
Also there is always the problem that if you or anyone else forgot to check the file loaded, the error will reappear...but if you parse, no matter what you always get eh same result...
Think holistically and prepare for the worst 🙂
In Power Query, go to transform in the ribbon and then Date>Parse
DataFormat.Error: We couldn't parse the input provided as a Date value.
Details:
7/18/1996
Thanks. I could resolve the issue. The solution worked.
Just a Note: I had the same error when I tried to format and American Date (MMDDYY). If you're in Europe (Ireland anyway) you need to arrange the date in DD/MM/YY.
Steps to be followed to resolve the Date Format Error :
1. When a CSV file is loaded in Power BI Desktop by default it detects the 'date/time' field as 'text' so when we try to convert we get an error.
2. Next Right click on the Field/Column you want to convert into a Date Field and navigate to 'Change Type' .
3. Next Click on 'Using Locale' option under the 'Change Type' dropdown.
4. Change the 'Data type' to 'Date' in the dialog box of 'Using Locale' as by default it takes it as 'text'.
5. Click on the drop down of 'locale'.
6. Then Select an 'Option' from drop down for which your Date field 'Format' matches exactly and Click on 'OK' .
7. Above steps will resolve the issue and same solution goes well for Date/Time column conversion also.
This is awesome detailed solution!
Thank you!
These steps were really helpful. thanks
Thank you! This solution worked for me 😀
this solution worked for me, thanks a lot for sharing your knowledge
Superb! Works perfectly
How would I fix this error? It appears after I perform a data refresh.
DataFormat.Error: We couldn't parse the input provided as a DateTime value.
Details:
18 Days 15 Hours 59 Minutes
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
93 | |
85 | |
83 | |
71 | |
49 |
User | Count |
---|---|
143 | |
132 | |
110 | |
66 | |
55 |