Forum Discussion
How to Remove Error in Date Field
- 8 years ago
If you are wanting to change all null values to a specific date (like 11/11/2011), then a simple replace values would work where you are replacing all null values with your ficticious date. You can also add a custom column with the following statement:
if [Your Date Column] = null then "11/11/2011" else [Your Date Column]
If you are trying to convert everything to a date and are receiving an error message, you can also try the following statement in a custom column (if your date column is currently text because of bad data):
try Date.FromText([Your Date Column]) otherwise (however you want the errors handled)
If the cells are empty, then it should be marking them as null instead of an error... Can you should me the data within the cells prior to the error along with the step that is causing the error?
The cells are blank, empty. When they are initially processed it is in a text format. I then convert it to date/time and get the erros on the blank dates.
- drewlewis158 years agoSolution Specialist
Do you have some sample data? I am not able to replicate your issue... When I try loading a table of dates into Power BI with blank cells within the table, I am not receiving an error when converting them to a date format. I might just be misunderstanding the issue...
- Anonymous8 years agoNot applicable
Did you ever figure this out? I am running into the same issue with needing blank cells in a date field. It errors out when I convert to a date.
- drewlewis158 years agoSolution Specialist
I am still not able to replicate the issue... When I have dates formatted as text and then converted to a date, all blank cells are shown as "null" rather than errors. I even tried adding spaces instead of having truly blank cells, but the query editor handled it in the same way. Is there some test data that you can share to help duplicate the issue?
- Anonymous8 years agoNot applicable
I finally figured out my issue. I thought it was brining in blanks when I looked at the data but it was actually bringing in "Unknown". I converted the "Unknown" to "null" and then changed the type to "date" and it worked. Support was able to help me with this. I believe I was looking at the data after I tried converting to a date instead of prior (which is why I saw blank instead of unknown) AND I forgot to "load more.." results to see in the drop down for the column what it was bringing in besides dates prior to trying to convert to a date.