powerbidaxpowerquerypowerbi-desktop

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


I have a column called date that is currently as data type text.

I try to change it to date and this is what happens:

enter image description here

The error says:

DataFormat.Error: We couldn't parse the input provided as a Date value.
Details:
    1/23/2022

I don't understand why.

I've been changing the data type of this column previously in other reports without problem.


Solution

  • Power Query interprets dates based on the regional settings defined for your query. For example, the format 1/23/2022 will be recognized as valid in regional settings that use the month/day/year format (such as in the U.S.), but not in settings that use the day/month/year format (common in many European or Latin American countries).

    You can adjust the regional settings of the query by doing this: Click on File > Options and Settings > Options > Current File > Regional Settings. Change the regional settings to match the date format (e.g., "English (United States)" for MM/DD/YYYY).

    Another solution is to create a new column that parses the data.

    = Table.AddColumn(PreviousStep, "ParsedDate", each Date.FromText([date], "en-US"), type date)