Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Error when trying to convert a date to a month name

I have a date field named 'Date Full'. I'm trying to create a field that displays the month name from the 'Date_Full' but I'm getting an error. The M Code for the step is this:   = Table.AddColumn(...
  • ImkeF's avatar
    6 years ago

    Hi the first argument of the Date.MonthName-function has to be of type date. In your case, you're referencing a table. The second argument is optional, but expects a text-string. That's what triggers the current error-message, because you've referenced a date-value there.

    So simply using it like so should do the trick:

     

    Table.AddColumn(#"Removed Errors", "Month_Name", each Date.MonthName([Date_Full]))