Tuesday, January 13, 2015

Group by Year and Month using calculated column in SharePoint 2013

How often have you wanted to group the data that you have created in a SharePoint List, by Month or Year, but not sure how to get that information without asking the user to capture it for you? The user experience should be simple and not become more and more cumbersome as you want more robust reporting. You can solve this problem easily by using use a Column with a calculated field.
The only criteria needed, to enable you to group by Month or Year, using a calculated column, is that there must be a base column in Date Format to calculate from.

In the list or document library created two columns, one for Year and one for Month.

For Year the formula will be:
=TEXT([DataField];"yyyy")





















For Month column, the formula will look like below:
=TEXT(MONTH([DataField]);"00")&" "&TEXT([DataField];"mmmm")

If you need the three letters of the month name, replace "mmmm" with "mmm"




















Now create the view, in the View the Group By condition should be look like below.












That's it!















No comments:

Post a Comment