Get it Together: Groups and Totals in the Data View Web Part (Screencast)
Author: Laura Rogers
Live Online Workshop Presenter
Stump the Panel, Moderator
SharePoint 911
When creating a regular list view in SharePoint, it is easy to set up grouping and totals, right out of the box. Unfortunately, when trying to achieve the same effect in a data view web part, there are some tricks to it. In this 5 minute screencast, Laura Rogers shows how to set up grouping and totals within a data view web part. Yes, there is a *tiny* bit of code involved, but it’s not too painful.
In this example, the column summed is a number column. For field types that aren’t numbers or currency, the only type of auto-format (the lightning bolt) available will be “Count”. Also, when working with field names that have spaces or other characters, the @FieldName part is a little more complicated.
Here’s how to obtain the real field name:
- Go to your list settings where you see the list of all of your field (column) names.
- Click on a field name, and this will take you to the page with all of the information about that field.
- Look at the URL in the Address box at the top of the browser. The very end of the URL will have: &Field=FieldName
- That part after the “=” is the real field name, and is what will be used inside any formulas when working in data view web parts.
On September 22, 2009 at 1:00pm EST, Laura is teaching a live online workshop, Excel and SharePoint: I didn’t know you could do that!”.
Author: Laura Rogers, Birmingham, AL
Laura Rogers is highly visible in the SharePoint community through her contributions on Stump the Panel, regular screencasts and articles on EndUserSharePoint.com and speaking engagements at SharePoint conferences.
Laura has ten years experience with Microsoft’s messaging and collaboration systems. This includes four years in SharePoint implementation, training, and customization. She has been a MCSE since 1999, with her most recent certifications being MCSE 2003 + Messaging, MCTS in MOSS and MCTS in WSS 3.0 Configuration. She wrote a chapter in the Microsoft Office SharePoint Server 2007 Administrator’s Companion by Bill English.
- New Article Series: Laura Rogers on Data View Web Part Basics
- Data View Web Part, The Basics - Insert a DVWP on Your Page
- 6 Minute Screencast: Insert a Data View Web Part onto a SharePoint Page
- Data View Web Part, The Basics - Folders
- 3 Minute Screencast: Use DVWP to display all files, even those stored in folders!
- Data View Web Part, The Basics - Add a Hyperlink
- Data View Web Part, The Basics - Keep it Clean
- Data View Web Part, The Basics – Multiple Edit Forms
- 3 Minute Screencast: Data View Web Part, The Basics – Multiple Edit Forms
- Live Online Workshop - Data View Web Part Solutions: Part 2
- 5 Minute Screencast: SharePoint Web Services for Non-Developers
- 3 Minute Screencast: Merging SharePoint Document Libraries
- 2 Minute Screencast: Permissions Dashboard
- 4 Minute Screencast: Join View of SharePoint Lists
- Get it Together: Groups and Totals in the Data View Web Part (Screencast)
- SharePoint: Open Links in a New Browser Window (Screencast)
- How to Create a SharePoint Data View Web Part “Rollup” (Screencast)
- SharePoint: "New" Icon (Screencast)
- Display a SharePoint List on Another Site (Screencast)
- Customize the "no items" Display Text in SharePoint (Screencast)
- SharePoint: Displaying Calculated Column SUMS in a View (Screencast)
Does this technique work with calculated columns? I’m making a simple vacation report to track how many days have been used… So my calc column is NumOfDays and I’m taking [End Date]-[Start Date] for the calculation. I’ve tried a bunch of different things but can’t seem to get this to total at all. It just show’s a zero. Can you help me?
Laura, you always end your clips the statement “Thank you”. I on the other hand would like to say a giant THANK YOU right back.
This is one of those tips that is so badly needed, relatively easy to use, yet which so few end users would stumble onto. Just what keeps me coming back regularly.
Armed with this tip I can finally start to use the Dataview web part in earnest across my sites.
Thanks again!
I’ve been using SharePoint designer and the data view web part since the SharePoint 2007 RTM and yet this is something I never “discovered”. Thank you!
Wo, nice. This is the second video I watched from you. Very good information and I will definitely try in my SharePoint designer to resolve the join view DataView issue.
Again, Thank you, Laura.
Thanks a lot for this video… Its very heplful for those people who wont use custom coding.
Thanks laura
Nazakath
hi Laura,
How can I get the “count” value if I have grouped the Data View Web Part by two columns ?
I can get only the count value of the first grouped column and I don’t “filter” this value by the second group field.
Thanks
Lorenzo.
“Count” is the only option that appears when I click the lightning bolt. Any ideas why the other options (Sum, Average, etc.) don’t appear?
Lorenzo,
I had the same problem. Then I did it again following Laura’s instructions exactly and it worked. I think the problem was that the first time i did it I pasted the cell contents from one cell to the next instead of copying and pasting the code as she suggests.
Paul
Awesome videos. I’m a rookie and learning a lot so a big thank you from Texas. I have an issue. I followed your dataview video and made a small dataformwebpart similar to what you had created. However my difference is that I created a column called Assigned and it is populated with our teammembers. I used this to group. I ran my calculations on my data and the overall sum data works great. However when I try to make a total within the employee grouping the result is a zero. I ALWAYS get 0 for count($nodeset/@Score). I’ve looked on the web and I’ve found others that have group by user, name, assigned, created by and the counts all return 0. Not sure why, but can you please off some friendly advice how to resolve.
Looks sort of like this.
TITLE DATE STATUS DIFFICULTY PERFORM SCORE
Assigned: John Doe
Data assingment number 1 5/1/10 Completed 3 4 12
Data assignment number 2 5/3/10 Completed 2 3 06
Data assignment number 3 5/4/10 Completed 3 4 12
———————————————————————————————————————————–
–> 0 –> 0 –> 00
Assigned: Linda Brown
Data assigned number 1 5/1/10 Completed 3 4 12
————————————————————————————————————————————
–> 0 –> 0 –> 00
—————————————————————————————————————————————————————————————————————————————————————————— 11 15 42
Outstanding presentation! Watching your videos has given me more help than any manual I’ve read. Thank you, thank you, THANK YOU!
Hi Laura, I’m having problem when I try to create “more than two level of group” in my list. Only two level of grouping can be done without error (1st by Customer > 2nd by Year).
* I’m using WSS 3.
Currently I want it to be somehow like this;
- Group by Customer
——————————-
+ Group by Year (2009)
– Group by Year (2010)
——————————-
+ Group by Month (Jan)
– Group by Month (Feb)
——————————-
+ Group by Unit (Unit A)
– Group by Unit (Unit B)
——————————-
| Quantity | Price Per-Unit | |Total |
4 2.00 8.00
2 2.00 4.00
5 1.00 5.00
7 3.00 21.00
——————————————————
TOTAL : 18 36.00
——————————————————
+ Group by Unit (Unit C)
+ Group by Month (Mar)
+ Group by Year (2011)