1,804 articles and 15,030 comments as of Monday, May 30th, 2011

EndUserSharePoint has combined resources with NothingButSharePoint.com. You can now find End User (Mark Miller), Developer (Jeremy Thake) and IT Pro SharePoint content all in one place!

This site is a historical archive and is no longer being updated. Please update your favorites, bookmarks and RSS feeds.

NothingButSharePoint.com
Tuesday, September 1, 2009

Get it Together: Groups and Totals in the Data View Web Part (Screencast)

Laura RogersAuthor: 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:

  1. Go to your list settings where you see the list of all of your field (column) names.
  2. Click on a field name, and this will take you to the page with all of the information about that field.
  3. Look at the URL in the Address box at the top of the browser.  The very end of the URL will have: &Field=FieldName
  4. 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!”.

Laura RogersAuthor: 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.

View all entries in this series: LauraRogers - Data View Web Part Basics»
 

Please Join the Discussion

11 Responses to “Get it Together: Groups and Totals in the Data View Web Part (Screencast)”
  1. Matt B. says:

    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?

  2. Kevin says:

    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!

  3. Chris Quick says:

    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!

  4. WebGuru says:

    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.

  5. nazakath says:

    Thanks a lot for this video… Its very heplful for those people who wont use custom coding.

    Thanks laura

    Nazakath

  6. Lorenzo says:

    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.

  7. Brian says:

    “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?

    • Paul Becker says:

      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

  8. Steve says:

    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

  9. Paul Becker says:

    Outstanding presentation! Watching your videos has given me more help than any manual I’ve read. Thank you, thank you, THANK YOU!

  10. Mutanic says:

    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)


Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!