0

i have a content-type "participants" with a field "number".

i want to calculate the total of all the values that are inserted in all the "participants"-node.

ie:

Node 1 -> 200 participants Node 2 -> 3 participants Node 3 -> 15 participants

Total: 218

Only the result should be visible

I was thinking to do it with views, but i'm not succeeding.

Any suggestions?

2
  • Where are you wanting to output this value?
    – thumbson
    Feb 13, 2015 at 3:41
  • it should be displayed in a block, value only
    – jimi
    Feb 13, 2015 at 8:01

3 Answers 3

1

Use views calc to achieve this behaviour, This module adds simple calculations to a views table: https://www.drupal.org/project/views_calc

0

Also you can have a look at this module

https://www.drupal.org/project/nodeviewcount

Node View Count module allows to count node views. Unlike statistics module, this module records each view of node with user uid and timestamp. So now you can know how many times a user viewed node by day, week, month and etc.

This module is integrated with Views module. You can use it to create different statistics pages, output new not viewed nodes for user and many more.

hope this helps :)

0

Views should be able to do this out of the box.

Create a block display showing fields and under your "Other" options, enable "Use Aggregation."

Add your field ("number"), select aggregation type "SUM" with your Group Column as "Value." In the next form set your label to Total. The key here is to not have a sort criteria. Filter by your content type "participants" and this should give you what you're looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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