Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a view with the following results:

           penalty    attorney_fees   other 
client1    100,000    100,000         0

client2    50,000     75,000          10,000

client3    25,000     50,000          25,000

           total?     total?          total?

How do I get the sum of the column "total" for penalty, attorney_fees, and other?

share|improve this question

You can use the Views Calc module for that. Here is an excerpt about it from the module's project page:

... adds simple calculations to a views table. Requires the Views module.

You can SUM, AVERAGE, COUNT, MIN, MAX, or AVG selected columns. A plug in theme makes the view look more spreadsheet-like (right justifies numeric fields, shades calculated columns and rows, and underlines calculated rows).

share|improve this answer
Thank you for the quick response. I have already tried Views Calc with no luck. – Let Feb 20 '13 at 23:15
What issues were you having? Views Calc seems like a good fit for this. How many rows are you calculating at a time? – Chance G Feb 21 '13 at 0:13
The Total SUM is amount is off. For instance, the Total SUM of penalty is 175,000 but the Total SUM of attorney_fees is 0. – Let Feb 21 '13 at 15:30
Views Calc it is possible to sum by cols? or rows – BandOfBrothers Jul 23 '13 at 8:52

you can download and install the Views Aggregator Plus module then your problem is solved. This module allow to the sum functionality in there. Here is an excerpt about it from the module's project page:

... As the Views and Views Calc modules rely on the database to perform aggregation, you only have limited options at your disposal. As the great Merlin himself said: "You can't aggregate a PHP expression in the database.".

That's where Views Aggregator Plus comes in. In addition to what Views and Views Calc do, this module:

  • enumerates group members
  • produces tallies, i.e. textual histograms
  • aggregates on Views PHP code-snippet evalutations
  • can filter out result rows on regexp patterns
  • gives you sorting on Views' Math expressions
  • can process Webform submissions
  • lets you add your own custom aggregation functions

... and it puts summary statistics at the bottom of your aggregated table as well!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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