When ever we create a view for a list there will be a section called Totals. We can use this section to calculate & display the total of the items in the list. This will be useful to display totals particularly when you use group-by.If you notice, you will be seeing some column names with a drop-down nearby with option “Count”. If you select this the count will be based on this column. But if you are having a calculated column in your list, it will not be displayed here. So in this case we need to create a data view web part using designer. In this case you can do total and other operations like sum etc..
- First create a Data view web part and apply grouping if needed (check this post).
- Don’t forget to select “Show Group Footer” in the Sort & group properties.
- Now you will get the data view displaying the list with totals for each group (as in above picture with count).
- If you notice the code related to count is Count : <xsl:value-of select=”count($nodeset)” />
Now I am having another column Man Hours in my list which is of Type Number. I want t0 display the sum of man hours for each group (in my case for each location i need to find the total man hours).
To do so I just replace Count : <xsl:value-of select=”count($nodeset)” /> with Total Man Hours : <xsl:value-of select=”sum($nodeset/@Man_x0020_Hours)” />
Now my list view looks like
You can notice Total Man Hours displaying total man hours for each location. You can try more functions other than Sum