The most popular post on my blog since its inception has been Filter Calendar View. In reviewing the post today I noticed that I had the filter wrong! Please accept my apologies, the updated filter and post is below:
(Updated: 3/23/2011: filter was wrong, is now correct)
So I am working on my pilot of the company intranet, and I created a corporate holidays calendar. I wanted to display on the home page only the title and date of the events that were upcoming within the next 60 days. I tried to filter by Start Date, but it doesnt display as a filterable column. I searched and found an old post with some syntax and tried it out and it worked.
If there is a calendar, and you want to create a view where only events from today up to the next 60 days (or how many days out), here is how you do it:
Add a column to your calendar. Name it “Date” and make it a calculated field. Add “Start time” to the formula, and select “add date only”. What this does is it creates a column that is filterable, because Start Date is not, and automatically populates the content of this column with the start date of the event.
Next, create a new view for the calendar, name it “Upcoming” (or whatever). Select whatever fields you would like to display. If you are creating a view to show on another page, like the home page, and you just want a quick list of upcoming events, you might want to just have title and date fields display.
Under “Filter”, select:
is greater than or equal to
is less than or equal to
What this does is tells SP to only display events with Date set to today or up to 60 days from now.
Make sure that wherever you want to see this view, you actually select this view in the View drop list.
(Update) Unless you add the second filter, the query will continue to show old posts. 3/23/2011: I had the filter set wrong, the filter should work correctly now.