I desperately need help with this...I have searched and tried everything I know.

I have come across a group count error. I have created a data view web part using a linked source. The DVWP has only one level of grouping: Date.

My Group Totals are incorrect (with the exception of the last group on the bottom). And my Webpart total count is also correct.

I can't display a picture but my Data Veiw Web Part presently breaks down is something like this:

Date: 1/15/2012

Entry 1

Entry 2

Group Count: 0 (Wrong Count)

Date: 1/31/2012

Entry 1

Group Count: 0 (Wrong Count)

Date: 2/15/2012

Entry 1

Entry 2

Group Count: 2 (Right Count)

Total Count: 5 (Right Count)

What is frustrating is that all the group counts are based on the same formula then why are the first group counts wrong when the last one generates the correct value.

Group Count Code:

<xsl:template name="dvt_1.groupfooter0"> 
<xsl:param name="fieldtitle" /> 
<xsl:param name="fieldname" /> 
<xsl:param name="fieldvalue" /> 
<xsl:param name="fieldtype" /> 
<xsl:param name="nodeset" /> 
<xsl:param name="groupid" /> 
<xsl:param name="displaystyle" /> 
<xsl:param name="showfooter" /> 
<xsl:param name="showfootercolumn" /> 
<xsl:if test="$showfootercolumn" ddwrt:cf_ignore="1"> 
<t r valign="top" style="display:none"> 
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1"> 
<t h class="ms-vh" width="1%" nowrap="nowrap"></t h> 
<t d class="ms-gb2 ms-altering" nowrap="nowrap"> Count : <xsl:value-of select="count($nodeset)" /></t d> 

Total Web Part Total: This portion shows the correct value and uses:

<xsl:value-of select="count(/dsQueryResponse/soap:Envelope/soap:Body/ddw1:GetListItemsResponse/ddw1:GetListItemsResult/ddw1:listitems/rs:data/z:row)" /> 

I would greatly appreciate your help.

1 Answer 1


I think this is similar to an issue I had. My issue was that the nodeset definition wasn't correctly identifying rows. I am guessing this has to do with the grouping being by date. Could you include the definition of the $nodeset from the template? You may have some luck of converting the date into a string to group by?

Summing a column on a DVWP with 2 levels of grouping with incorrect subtotals


this code would go in the body template definition in the footer template call as the parameter. @Field would be whatever the field you were grouping on.

<xsl:with-param name="nodeset" select="msxsl:node-set($dvt_Rows)/root//Row[((@FIELD)=$groupfooter0 or ((not(@FIELD) or @FIELD='') and $groupfooter0=' '))]" />

  • You are right my questions is very similar to your issue. I had reviewed your post first before posting my question. There are many reasons, but one main reason why I know that it is not the date format or column that is causing the issue is because I am calculating a total sum for one the numeric columns as well. The sum has the same issue. The total is correct for the last group but zero for all others (I also tried deleting the last group to see what happens. In this case the initial second to last group became the last group and had correct calculation and all other group were zero).
    – ssvv
    Mar 13, 2012 at 17:13
  • I noticed in your post you defined 'nodeset'. I have pasted my code with code parameters, I would appreciate if you can tell me how I can define the 'nodeset' to include all rows in a group. Or if there is a way I can use dsQueryResponse to generate the group count. Thanks.
    – ssvv
    Mar 13, 2012 at 17:14
  • You posted your code from your template definition. The 'nodeset' is defined further up when the template is called look for <xsl:call-template name="dvt_1.groupfooter0"> up in the body template definition. In that section, it defines the nodeset to be used in that footer and it sounds like that needs adjusted.
    – cfoote
    Mar 14, 2012 at 14:58
  • Did you get your solution working? I am interested to hear how you solved it.
    – cfoote
    Mar 23, 2012 at 19:31
  • 1
    Thanks for the feedback. I found the solution. It turns out I cannot group based on mm/dd/yyyy date format. In order for me to group and get correct column totals the date must be in yyyyMMdd format. So I added a calcuated date column with yyyyMMdd format and it worked. Thank you vey much for your help.
    – ssvv
    Mar 29, 2012 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.