I have a view right now that takes data such as # of properties owned and Square footage total by region. So for example if someone clicks the northeast region of a map they'll get the number of buildings and square ft of properties in that specific region, displays them, then at the bottom totals them.

I'm trying to come up with a way to take the totals of those regions, display them in another view and then add THEM up for a grand total.

Is this something that can be done with views? If not, is there another solution that can work with the view already implemented?


Probably the simplest way to do this via Views is to add the Computed Field module to your site, and build a new content type (maybe "summary"), and add a summary for each kind of property you'd want to add in the view, and then use the computed fields to calculate all the grand totals. Display the computed fields in a new view, and it should work fairly well.

However, that wouldn't be all that dynamic. There are probably ways to do this in views itself by adding groupings, relationships, and calculated fields, but you'll end up with a view that's fragile and a real pain to maintain via the UI. You might want to approach adding a views attachment, or a display after the view, or just use some plain old custom code to generate a block (or within a block if you use the PHP filter, but I would not recommend this approach).

Another possible solution (if it's simple feature set gives you what you'd need) is the Views Summarize module.


You should be able to:

  • first under the View's advanced settings, switch "Use aggregation" to Yes
  • select the Region as a field, and under the Aggregation settings, set it to "Group results together"
  • then for the other fields (num of buildings and square ft), use Aggregation settings "Sum"

You might need to also Sort by Region, and also aggregate the Sort Criterion as "Group results together"

That should give you the subtotals for each reason. Then you can use Views Summarize to get the grand totals.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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