So i have a taxonomy called Product Warnings, and it has around 10 terms. This taxonomy is referenced in several content types (Small products, Large products, etc), and can be selected multiple times (so a user can select in the content type 1 or up to all 10 terms from the Taxonomy).

I want to create a view which lists all terms from the given taxonomy (that's the easy part), and also count the number of times each terms is referenced in a specific content type (i.e. Small products)

So it would look like:

Eye damage: 44
Skin irritation: 13
Hair lose: 1 

Now, this is fairly easy to do with a db_query and custom code, but the trick is to do it in a view (if it's possible)

3 Answers 3


Found the answer i was looking for, and that is to turn on Field Aggregation from the 3rd panel in the view.


I am not sure if it is possible to get that in a view but I know you can make a view to show content of all types, display only fields - taxonomy terms. Then, you should be able to use aggregation and count each terms occurence. Might not be the best solution tho as this one can drastically decrease the performance of that view since it counts each node.


I think you need to enable the aggregation in the view. the video here explains the same issue but in Drupal 7, but it's okay, it is the same for Drupal 8

Your Answer

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

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