I have two content types, Forum and Discussion (urelated to the core forum module). The content type Discussion has a node reference to the Forum it belongs named field_forum. I would like to create a views list which show nodes of Forum with no. of comments of nodes Discussion referencing to it.

Apparently, not a problem:

Just create a view of Forum with a reference "Entity Reference: Referencing entity" (A bridge to the Content entity that is referencing Content via field_forum) and then add a "Content: Comment count" field using this reference, set aggregation to on and set aggregation type for this field as sum.

However, my problem is that, even if I DO NOT check the option "Require this relationship" when I create the relationship, still adding comment count field make forums without any discussion to be excluded from the view, while I want all forum to be there, with or without discussions.

If I remove the "Comment count" field, all forums are visible. Strange enough, using the same techniques for counting the discussions works without problems.

This MAY be related to #1349080 but unfortunately it works with or without the patch in #231 (that solves similar problems in other contests).

1 Answer 1


Solved using the following workaround (patched #231 of #1349080 required): add a second level relation discussion->comments and then use the aggregation with count distinct operator over the id field of the comments.

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.