Forum Discussion
Group By month
I tried using the MONTH function like bellow:
=MONTH([WeekStartDate])
And I get the following error.
"The name 'MONTH' wasn't recognized. Make sure it's spelled correctly.
Also how can I add the YEAR function to that? I want a format that would look like "Month-Year".
Hi mork,
I think you're searching this: monthYear = MONTH(table[WeekStartDate]) & "-" & YEAR(table[WeekStartDate]).
- mork10 years agoHelper V
Anonymous That should work but it doesn't. I get the same error.
What I'm doing is that in powerquery I select the "add column" tab and then I select "add custom column". A window pops up and I write the formula in the window. But the formula is in DAX language and not in M. Maybe that's the error? But I don't want to create a calculated column outside of powerquery because I want to group according to that column.
- Mi2n10 years agoMicrosoft Employee
Hi mork.. you can always look for the necessary M query formulas in the below link.
https://msdn.microsoft.com/en-us/library/mt211003.aspx
In your case, you would have to use the Date.Month() function.