Thursday, July 17, 2008

HowTo: Using SharePoint Calculated Columns to Display Current Month List Items

Today I was asked by a co-worker to see if I could modify their SharePoint view to only show tasks created in the current month. I knew this option was not previously available as a standard choice but I have not done any SharePoint development in years so I was hoping SharePoint Services 3.0 would have added this feature.

After spending a couple minutes in Edit List it was apparent that it was not available. A quick Google search did not produce any "easy" solutions so I thought I'd blog my solution.

My solutions involved creating two computed columns (both calculated columns return Date Only values):


  1. Created First Day Of Month

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

  2. Created Last Day Of Month

    =DATE(YEAR([Created]),MONTH([Created])+1,1)-1

I then added the below filters to view:



That's it. Basically I create a computed column for the first and last day of the month when the task was created and then filter by today's date being between the two. I found this to be an easy and quick method. Please comment and let me know if there is an easier method.

7 comments:

l'3nfant terrible said...

Thanks! Very helpful. And you are correct in the confusing mess that is googling for such a simple function. Cheers.

Ryan said...

I've used the same technique in this post along with functions to show the previous calendar month, current calendar week etc.

http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/

Ang said...

This works great! I really appreciate the help.

vikranthreddy said...

this is working fine for current year only.When i add a list item with previous year it is not working

Anonymous said...

nice

Anonymous said...

Heres our latest NFT

https://www.imagebam.com/view/GA55OZ

Mycatstinx.

Anonymous said...

VIVA ISRAEL.