Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to get the sum of a field across a list of nodes in a view. Heres the scenario: I have a content type called "mileage" which allows each user to enter the mileage on a single bike trip. I would like to create a view that displays one list item for each user with a sum of the mileage nodes from that user, one "total" number.
Any help that can point me in the right direction would be great!
Comments
Comment #1
egsj CreditAttribution: egsj commentedAlso trying to do this.
Comment #2
jon_stewart CreditAttribution: jon_stewart commentedWorking out stock value from shop.
In my case, trying to use this to list stock_item_volume x cost_price, to work out a line value, then sum the line values, so that I have total value of stock in store for accountancy purposes.
The logic is trivial, except when you consider how Ubercart, Views, and views calc interract to give me a number of lines and a sum that is approximately 3 times what they should be.
Another puzzle!
Comment #3
okeedoak CreditAttribution: okeedoak commentedSubscribing, 'cause I think this will require custom code.
Comment #4
JohnnyBeGood-dupe2 CreditAttribution: JohnnyBeGood-dupe2 commentedI've solved something similar a few days ago.
Read this and check if it helps you.
Comment #5
hockey2112 CreditAttribution: hockey2112 commentedDid you ever figure out this mileage calculation? I am doing something very similar in Drupal 7.
Comment #6
KarenS CreditAttribution: KarenS commentedThe D6 version is no longer supported.