Group A List by Week Number

I’ve seen several requests recently for how to Group a Sharepoint list by Month.  I’ve also seen several Blog posts on how to do it.  But recently I saw a query about how to Group by the Week Number of the year and several responses stating that it couldn’t be done.  I’ve always liked a good challenge, especially one that someone else says is IMPOSSIBLE.  So I decided ot figure out how to do it.  The results are below.

To Group a List by Week Number do the following:
 
  1. Make sure the list has a column that contains the Date you wish to GroupBy.  I’ll use the Start Time column of a standard Event list but you can use any Date/Time column.  You don’t need to filter out the Time portion first, it will be ignored.
  2. Add a Calculated column to the list called ‘WeekNumber’ that uses the following formula:
          =INT(([Start Time]-DATE(2007,1,1))/7)
    where [Start Time] is the date column whose week you want to group by.
  3. Set the data type of the Calculated Column to Number with 0 decimal places
  4. Create the view that you want Grouped by Week.
  5. SORT the view by [Start Time] and GROUPBY the [WeekNumber] column.

You’ll get a view that looks something like this:

GroupBy
 
This will give you a grouped list with the week number from the first day of the year.  But January 1st is rarely a Sunday or Monday.  If you want to be more accurate substitute the date of the first Sunday prior to 1/1/2007 in place of Date(2007,1,1).  This will give you the week number counting from the First partial week of the year.
 
Of course you’ll need to redo the calculated column when January rolls around next year, but only to change the Calculated Column to point at the first day of next year.
 
 

VTI Shooting brings back bad memories

I wasn’t really planning for this to be the second post on my new Blog, but the events at Virginia Technical Institute bring back too many bad memories.  My prayers go out to the family and friends of the students and faculty at VTI.  I know a little of what they are going through. 

In May, 2003 I went through a similar attack while a professor in the Business school at Case Western Reserve University in Cleveland, OH.  Compared to VTI we were relatively lucky, only one student was killed and two people injured, but we certainly didn’t feel lucky at the time.  Three PhD students and I were trapped in my office on the 5th floor of the building from the time the shooting started at 4:00 PM until SWAT rescued us at 12:30 AM the next morning.  At one point while trying to FAX a phone list for the building to the local police I came face to face with the gunman.  It was a terrifying experience.

MSNBC has a good report of the attack at Case Here: http://www.msnbc.msn.com/id/15767366/

including some of my testimony at the gunman’s trial http://www.msnbc.msn.com/id/15787964/

Welcome to my BLOG

Well its been a long time coming, but I’ve finally decided to start a BLOG.  I’ve never been much for keeping Journals, but now its time.  I’ve spent the last couple years starting my own Consulting/Training business.  In that timeI have continually stumbled across technical "Nuggets" by listening to students or while researching student questions.  But I’ve never had anywhere to publish those "Nuggets".  A Blog seems to be the perfect place to store this kind of asynchronously acquired information in a categorized format. 

Now that I’ve decided to give up the “freelancing thing“ and go to work for Mindsharp fulltime I don’t even have the excuse that I’m too busy trying to build the business.  Since Mindsharp has their own Blog hosting site its finally time.

So watch this space and I’ll try to share the things I learn about SharePoint, CRM, and .NET development.  Hang on to your hats its liable to be a bumpy ride.

Paul Stork
MBA, MCT, MCSE, MCSA, MCSD, MCDBA, MCITP