Creating a Current Year View in SharePoint

Office 365 / SharePoint Blog

SharePoint can handle some date calculations on the fly. One of those is to use [Today] which lets you create upcoming views or past views based specifically on today’s date. Such as, use [Today]+7 to generate the next 7 days. Or use [Today]-21 to give me a date from 3 weeks ago.

SharePoint is not so good at handling current week or current month, or even current year. I created a blog post for the current week in a previous post, as well as a post for the current month. Today I am sharing the formula for creating the current year view.

Just like a week view, we need to create a YearStart and a YearEnd field to gather the beginning and end of the month.

Both of these columns are calculated fields.

The formula for the Start of the Year is

=DATE(YEAR([Created]),1,1)

It’s essentially an EXCEL formula that works in SharePoint. To break apart this formula, let’s look at each part:

The Date Formula gathers the YEAR info, then the MONTH info, and then the DAY info.

The above formula then essentially says:

  • Give me the Year from the Created field
  • Then give me the first month (1)
  • Then give me the first day (1)

The formula for the End of the Year is

=DATE(YEAR([Created]),12,31)

Which tells SharePoint to do the following:

  • Give me the YEAR from the Created field
  • Then give me the 12th Month
  • Then give me the 31st day

Applying these columns in a Filter

The next step is to use these dates in a filter so it will show you the current month.

We do that through the use of VIEWS

In the filter section of the view, use the following references:

Column: YearStart is less than or equal to [Today]

Column: YearEnd is greater than or equal to [Today]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s