Views - Aggregate Sum - Help!

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
spessex's picture

Hi

I have a very simple view to test the 'SUM' aggregation type but I cannot get it to work. All I am trying to do is sum the values of two content types decimal fields.

I have one column with content title and one column with value.

Please note I have 'aggregate' on, I have no sort criteria and no relationships or contexts to make things easier, the title column is on aggregation type 'group results together' and the value aggregation type 'SUM' with Group Column 'Value'.

No matter what I do I cannot get the column to sum?

Please note COUNT works.

If anyone could advise it would be most helpful.

Thank you

Stephen

PS Please note I have used the module 'Views Calc' and even though this does the job it will not work where a view has a relationship and the reason I'm conducting such an easy test with Views Aggregate SUM is that I require it to work for a more complicated view with many relationships.

AttachmentSize
Screenshot 1.png39.7 KB
Screenshot 2.png281.96 KB
Screenshot 3.png138.76 KB
Screenshot 4.png148.33 KB

Comments

The reason this isn't working

Sizzly's picture

The reason this isn't working is because each node title is unique so when you group on the title it creates a line for each node. In order to pull this off you'd need to have a value that's shared (like a taxonomy) that you can group on and then it will work properly.

But... If you want to just sum all of the values for a particular node/content type simply remove the title, add "Content Type" and group by that and sum the field with the number and you'll get a view that displays the total of all values shown by the view.

Hope that helps.

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: