Forum Discussion
mork
10 years agoHelper V
Group By month
Hello all, I have a table of my Resources work per week that I'm trying to group by month. How can I do that? Example table bellow. ResourceName Week# WeekSt...
mork
10 years agoHelper V
I figured thats what I would have to do, can you provide the formula for the calculated column?
mondinelli
10 years agoAdvocate I
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.
- mork10 years agoHelper V
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
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?