Forum Discussion
Group By month
Number.From(Date.Month(Date.From([DATACOLUMN])))+100*NumberFrom(Date.Year(Date.From([DATACOLUMN])))
or
Date.Month(Date.From([DATACOLUMN]))&"-"&Date.Year(Date.From([DATACOLUMN]))
mork take https://support.office.com/en-sg/article/Power-Query-formula-categories-125024ec-873c-47b9-bdfd-b437f8716819 as a reference. But it's not exaustive.
mondinelli I tried both your ways and only the first worked but I don't want that format... I prefer the format of the second way that doesn't work.
- Anonymous10 years agoNot applicable
mork which is the error while trying the second way?
- mork10 years agoHelper V
It doesn't show an error, it just creates the column with the word error in every cell.
- Anonymous10 years agoNot applicable
Mmm it's strange. First of all, you have problems with the "WeekStartDate", which is the format of that column? Because in my example dataset I've no problems.
With the formula I've posted I get something like this : 1-2016
You can also try to create two separate custom column, one with Date.Month() and one with Date.Year() and then merge them together.
- Anonymous10 years agoNot applicable
mork try this:
Number.ToText(Date.Month([WeekStartDate])) & "-" & Number.ToText(Date.Year([WeekStartDate]))
- mork10 years agoHelper V
Anonymous That worked but can I change it to date type?