viernes, 15 de enero de 2010

Grouping by month a list

24 February, 2006

SharePoint list: Group by month

If you have a SharePoint list that contains a date column, you may want to create a view that groups all the items by month. For example, in a standard task list you can create a view that groups the tasks by which month the Due Date is in.

To accomplish this, create a calculated field that returns a single line of text and has the following formula:

=YEAR([Due Date])&"-"&CHOOSE(MONTH(DATEVALUE("1/"&MONTH([Due Date])&"/"&YEAR([Due Date]))),"01. January","02. February","03. March","04. April","05. May","06. June","07. July","08. August","09. September","10. October","11. November","12. December")

Then select this field under Group By when customising your view. It can also be used for filtering and a similar calculated field can be used to group by week or by year.

Thanks to Ivan Wilson's post, I realised I don't need an unmanageable long nested if-statement to accomplish this. The CHOOSE function is very useful.

No hay comentarios.:

Publicar un comentario