An expanded version of this article, along with many other customization examples and how-tos can be found in my book, SharePoint 2007 and 2010 Customization for the Site Owner. This is an update of an article written for SharePoint 2007. Many of the steps are the same in both 2007 and 2010, but both the SharePoint Designer steps and the default web part used for views have changed. Group By on more than 2 columns in a view In my SharePoint classes I have often been of asked how to group on more than two levels in a view. I have always given the quick answer of "use SharePoint Designer"! But, some of you have asked "How?". You may be sorry you asked… but here goes… Goals: Create a view with nested groups deeper than just 2 levels Put the counts and totals at the bottom of each section. Do the above with no custom web parts, custom XSLT or anything that has to be deployed to the server. Sample: Secrets and Tricks needed: It can't be done "out of the box" in the browser SharePoint Designer is needed to make the edits You need to convert the view web part to a SharePoint Designer Data Form Web Part You need a Sort and Group secret You need to fix the footer rows You need to manually add your totals, averages, counts etc. Warning! SharePoint 2010 does not consider a page with a Data From Web Part to be a “view”. It only believes that a page is a “view” when it has an “Xslt List View Web Part”. In 2007 we could create a new view, edit it in SharePoint Designer as much as we wanted, and it was still a view. In 2010, SharePoint will not recognize a page without a XsltListViewWebPart as a view. So before you start… If you just need a page with your list nicely grouped, it may be best just to create a web part page and store it in a library. Then add the Data Form Web Part using the steps below. If you want the page to be treated as a view, leave the XsltListViewWebPart on the page, but make it hidden. Then add the Data Form Web Part below the existing web using the steps below. In SP 2010, a view page with an added web part introduces a bug or two. The ribbon will not be displayed. The view dropdown in the page title area will be missing the dropdown to select another view. My Example: I have a simple list (actually imported from Excel) with these columns: ID1, Bike, BikeType, BikeSize, BikeColor and Retail (price). I want to group this on BikeType, BikeSize, BikeColor and count the items and sum or average the price in each group. Create a new Standard View from the list's view menu. Don't bother with any options as we are just going to delete the default list web part. Or just create an empty web part page. (see “Warning” above) The “before” – just a standard view with selected columns: If using an existing view page: Open your site with SharePoint Designer and click the Lists and Libraries node in the Site Objects pane Click your list (“Bikes” in my example) Click your view you created earlier (“Grouped” in my example) Otherwise create a new web part page in a library Notes (background only, you can skip this): The view is now being displayed using a XsltListViewWebPart (It was a ListViewWebPart in SP 2007) and can only be customized with the same options as found using a browser ("Modify View") The XsltListViewWebPart has the same grouping limitations and the ListViewWebPart (2 levels of grouping) For more info on what has changed from the 2007 ListViewWebPart and the XsltListViewWebPart see http://msdn.microsoft.com/en-us/library/ff806162.aspx and http://msdn.microsoft.com/en-us/library/ff604021.aspx SharePoint Designer 2010 has two web parts for lists: XsltListViewWebPart - this is the web part used when you create a new View DataFormWebPart – created from SharePoint Designer using Insert, Empty Data View SPD 2010 adds a bit of confusion when trying to add a “Data View” When you click Insert, (pick an existing list) SPD inserts an XsltListViewWebPart When you click Insert, Empty Data View SPD inserts a DataFormWebPart If starting with an existing view, delete or hide the existing web part. Delete: In the Design window click in the web part, click the WebPartPages:XsltListViewWebPart tab, press the Delete key or in the Code window select the entire count stufftotal goes here Steps: Find "colspan="99"" for the first group footer row. (Tip: Did you find a header or footer row? Look up two lines and you should see ") (down about 16 lines of html) After the end tag add the other cells (TD tag pairs), one for each additional column (I need four more) Now to add the total… Switch to Design view and you should see the new cells in one of the footer rows. Click in the cell where you want the total Right-click and select Insert Formula Build your formula. For a total double click "sum" in the function list then select your field from the dropdown list. My example needed: sum(@Retail) The formula editor does not know one extra piece of information needed here. The @Retail field needs to come from the current group only. To get this, update the formula like this: sum($nodeset/@Retail) ("nodeset" is all lower case) Tip: How would you have discovered this? Go look at how they calculated the Count: count($nodeset). Notice that the formatting is wrong. The total is left aligned and the wrong size. To match the font and size find the style used for the data in the row above. In my example it looked like this: Copy the class info (Class="{$IDADW3HE}") into your total cell (the TD tag). The result will look something like this: The last step is to right align the cell (you can use the toolbar button) and to format the total. To format the number, click in the cell with the total, right-click and select Format Item As… and pick your formatting options. Note: SharePoint Designer may get creative and merge your formatting in new styles with great names like style1, style2, style3 etc.. If you are curious, do a search for .style1 (dot style1) and you will find they have placed the style class definition in the PlaceHolderBodyAreaClass master page placeholder. Fix up each footer row, including the View Footer, the same way. Add the extra TDs, add the totals, counts, etc, and format the results. Now about the View Footer… and some things to make your head hurt… The View Footer is built in its own HTML table, so the column widths are not going to line up with the rest of the list. (I'll have to come back with another article to make these line up correctly). The grand totals need a special calculation to sum all of the rows. The @Retail field (or @yourfield) needs to come from the entire set of rows. To get this, update the formula like this: sum(/dsQueryResponse/Rows/Row/@yourfield) (make sure the capitalization is correct!) Tip: How would you have discovered this? Go look at how they calculated the Count for the View Footer: count(/dsQueryResponse/Rows/Row) . Finally all done! A lot of steps, but it's a fairly routine and mechanical process. Do it a few times and you to will be able to amaze your fellow site owners! Hopefully the next version of SharePoint (2014?) will support more than two levels of grouping. Then we can all brag: "Back in the old days I had to … " BUG!!! There is a grouping bug in the Data Form Web Part… read the comments at the end of the original article for details. I hope to revisit that issue for 2010 shortly. If you want to go exploring in the mean time, here’s the fix for 2007. .