Recipe 63: Views Calculations
Note
Ingredients
Completed Recipe 1, swim_groups
Views Calc module: http://drupal.org/project/views_calc
The Views Calc module offers sums, counts, and averages for view rows and columns. The module does its math on a page-by-page basis, so the easiest way to perform a calculation on all the items is to set the view's Nodes Per Page value to be equal or larger than the number of nodes in the view.
Install and enable the Views Calc module.
Clone the swim_groups view, at
admin/build/views/swim_groups/clone
. Name the view swim_groups_count and change the url toswim-groups-count
. Set the view type to Calc Table View and ensure that at least one field is displaying in the Fields section.Select the Views for which calculations will be enabled at
admin/config/views_calc
. In our case, we'll select only the swim_groups_count view.Configure Views Calc Fields for the swim_groups_count view by selecting the Configure Fields tab at
admin/config/views_calc/view
. Open the View...