Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

'State' is the vocabulary of my taxonomy where North, South, East & West are parent terms with child terms like Montana, Texas, New York, Washington respectively which are states of USA.

I've created some dummy nodes on based of the child terms from taxonomy, is there any way to display the count of nodes from the parent terms of that taxonomy, so that the result would be something like North 10, South 5 and so on

share|improve this question
add comment

2 Answers

Try creating a Taxonomy View with the following settings.

  • field: taxonomy term/id
  • filter: taxonomy vocabulary; states vocabulary
  • contextual filter: taxonomy term parent; display summary, show link w/ count, set a base url for link

I have done something similar with a contextual filter of Taxonomy Term/ID and it works fine. Should work with Term Parent. you might have to add a relationship to content as well, not too sure but that should get you started. Good luck!

share|improve this answer
    
Thanks, I tried it but it doesn't seems to be worked for me :( Here is my exported view: pastebin.com/tnrs6SnJ Thanks. –  Rishi Kulshreshtha Aug 13 '12 at 6:07
add comment

Although this is an old question, I just had to do something similar and decided to share the steps (I'm using views 3):

  1. Create a content view listing your nodes.
  2. Add a relationship "Content: Taxonomy terms on node", limit this to the "States" vocabulary and give it an Identifier like "term_on_node".
  3. Now add another relationship "Taxonomy term: Parent term" using the "term_on_node" relationship defined in the previous step. Name this one "parent_term".
  4. Enable "Use aggregation".
  5. In "Format" select to show fields.
  6. Add the following fields:
    • "Taxonomy term: Name" using "parent_term" relationship
    • "Content: Nid"
  7. For "Content: Nid" click "Aggregation settings" and select "Count DISTINCT"

Now this view should display your parent terms with the number of nodes assigned to each parent's children.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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