This is the problem: I have a Drupal 7, Views 3 site with a certain node type with a Fivestar field on it. I want to get total scores not for one node, but for all the nodes in a view.

For example, let's say our nodes are "restaurants". A person can write a review for this restaurant and give it a score.

Okay, now imagine some of these restaurants are thai restaurants. Now imagine I want the average score for all the thai restaurants in a view. Be careful about this, I don't want the average for one of the restaurants, but for ALL the restaurants in a given category. That's clearly a work for views, but how? How do I do that?

Thanks in advance.

  • 1
    I'm not fluent with fivestar, but can't you make a view with only vote field? Then use relations to relate votes to restaurants, restaurants to category (you mean taxonomy?) and then filter by that taxonomy? If you can, then you can turn on aggregation on vote field and you're done. You can add category field, too, but not any field from restaurant. Skipping review for now, but consider some clarification, like what have you tried with views and what output you got vs the one you wanted, apparently your question is not clear enough for some of higer-rep users.
    – Mołot
    Dec 12 '13 at 8:16

Create a view:

  • Use Agregation.
  • Use fields.

Add fields in this order remove everything else:

  • Taxonomy or (Category) as you call it. (Aggregation settings = Group results).
  • field_rating (or your five star field). (Aggregation settings = Average).


  • Published (YES).
  • Content type = (restaurants).

What you need to do in resume, is to call all the nodes of type "restaurants" group the results the taxonomy field by Aggregation and AVERAGE all the ratings.


First, thanks both for your replies. For some reason I didn't receive the notifications on your help, so after a lot of "wall-hitting" I found a solution related to Israel Morales' advice:

1 - Israel Morales was right on its explanation, but please notice that if your sort the result set by any field with unique values, such as Date, the aggregation process will never happen. That was my mistake, That was added when creating the View, I forgot to remove it in the first place. 2 - Views aggregation works fine for numeric values, but it falls short working with strings. Then i discovered VIEWS AGGREGATOR PLUS module. To work with this module you better deactivate Views own aggregator and use the one included in the module, because they are separated processes and it can become a mess. It only renders tables, but it adds quite interesting options to work with strings. For example, it can show data like this:

Who were you at the restaurant with?

Alone : 12 Friends : 25 Couple : 16 Family : 9

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.