Forum Discussion

lastnn30's avatar
lastnn30
Icon for Post Patron rankPost Patron
4 years ago
Solved

changing date from text to date

Hi I have a column which has [Text Date Text] in one cell. I used power query to split text and date into different columns. Now I have the Date in one column but in Text format. I click on ABC of P...
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    Yeah, I'm pretty sure this is the issue. This uses the optional "culture" argument of Table.TransformColumnTypes to pick the appropriate way of interpreting the date format.

     

    Another way to do this is to tweak the M code directly. If the date format is dd/mm/yyyy, then you can write

    Table.TransformColumnTypes(
        #"Split Column by Delimiter",
        {
            {"Item.1", type text},
            {"Item.2", type date},
            {"Item.3", type text},
            {"Sales", type number}
        },
        "en-IN"
    )

    If the date format is mm/dd/yyy, then use "en-US" for the last argument instead.

     

    (There are plenty of other cultural choices but these are the two I remember for the sake of date interpretation.)