0

I am trying to get the SUM of a group of fields in a view. We hold events and I wanted to create a view that showed How many degree types by total. See below image for quick idea.

enter image description here

So, If there are 20 MD's, I want one row that shows MD's with a total of 20 - versus 20 rows of MD's.

I have look at views aggregation but since it isn't a number I can not see it working. I have also looked at view calc but that just shows a total at the bottom.

I am looking to figure out the best way to handle this. If I have to custom code any help pointing me in the right direction would be greatly appreciated!

1

You want to try using the Views Aggregator Plus community module.

The example from the Project page (very similar to your own):

Say the original View based on raw database results looks like below.

Industry    Company Name    Turnover
IT          AquiB           $25,000,000
Clothing    Cenneton        $99,000,000
Food        Heiny           $66,000,000
IT          PreviousBest    $5,000,000
Food        McRonalds       $500,000,000

Then with the grouping taking place on, say Industry, and aggregation functions TALLY, ENUMERATE and SUM applied on Industry, Company Name and Turnover respectively, the final result with a descending sort on the last column will display like below. Note that the module identified three groups. It also added a totals row, Views Calc style.

Industry        Companies            Turnover
Food (2)        Heiny, McRonalds     $566,000,000
Clothing (1)    Cenneton             $99,000,000
IT (2)          AcquiB, PreviousBest $30,000,000
Totals              5                $695,000,000

At that point I think you just need to play with output settings of that module ...

  • Thank you. The hard part now if figuring out how to make is work on my data. Initial try it isn't outputting it the way I want yet but will keep trying. Thanks! – timwhelan Sep 23 '14 at 14:46
  • IS there a tutorial out there for the Views Aggregator Module? – timwhelan Sep 23 '14 at 15:03
  • ... this is the 2nd Google result for "views aggregator plus" wdtutorials.com/tags/views-aggregator-plus That Youtube tutorial shows how to aggregate a columns' value, i think it's exactly the "38" total you want. – tenken Sep 23 '14 at 16:41
0

You can use the Views Calc module.

This module 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).

enter image description here

Then all you need to do is to set up aggregation properly. You should do a COUNT aggregate on a field that all of your degrees have in common, for instance content type.

  • Reynolds, OP tried this module. Find in OP's post -> "I have also looked at view calc but that just shows a total at the bottom" I think you missed this point from OP's posts :) – Krishna Mohan Sep 23 '14 at 7:35

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.