I have a content type called 'schools' and I have a vocabulary called "destinations" that contains:

-- New York
-- Miami

I have 2 school nodes that are tagged with "New York" and "Miami", respectively. So:

School 1: Terms tagged with from "Destinations" vocabulary: "USA",  "Miami"
School 2: Terms tagged with from "Destinations" vocabulary: "USA",  "Miami"
School 3: Terms tagged with from "Destinations" vocabulary: "USA",  "New York"

I want to show a view on the top country level page. So on the USA page I want to show:

City: New York No of Schools: 1 Name of School: School 3

City: Miami No of Schools: 2 Name of School: School 1, School 2

I know how to create a view to show me the city name using a contextual filter: Taxonomy term: Parent term. But is there a way I can get the other two things to show: count of schools and name of schools? In the same view..

  • How does No of Schools relate to City or School? Please expand your Results example with more Schools assigned to either City.
    – prkos
    Commented Oct 3, 2018 at 17:37
  • Done. My school content type has a term reference field that references the vocabulary called 'destinations'. This is a field on the node edit form with hierarchical select. So I would use the drop down on node edit form, choose "USA" then the next choice would be "Miami", then create than school. etc Commented Oct 4, 2018 at 5:32

1 Answer 1


The problem with your question is that you want to use both Aggregated and Grouped data in the same Row.

Additionally you want to show more than one School in the same Views row, while the Title isn't a multi-value field, you're not linking Schools from Terms but Terms from Schools.

You can use an additional module to achieve that: Views Field View, although it may be performance heavy.

You can easily create a View that would display either one or the other case:

City: New York No of Schools: 1
City: Miami No of Schools: 2

To achieve that see my answer here: Create a Term Queue on views only instead of adding a Sorting criteria you add Content: Title under Fields and set it to Count Distinct under Aggregation settings.

Or this case:

City: New York Name of School: School 3 City: Miami Name of School: School 1, School 2

To achieve that follow that same procedure only don't use Aggregation and under Format select the City field as a Grouping field. You can achieve many different layouts with clever Format settings and overrides.

To combine these two views use the Views Field View module to insert the second View into the First one and use the City field as an argument that you pass to the second View.

So the first View would have a Contextual filter for the Country (the first level of Taxonomy), and the second View would have a City Contextual (second level) or something along those line, depending on your particular configuration.

You should first aim to build those Views separately and make the Contextual filters work, then use the Views Field View to combine them.

Another way to go about solving this is mentioned in the Answer I linked to: Use Views Summary to display Terms with node count, then when you click on the term it takes you to actual Views results page showing nodes for that term. This is a two-step process but it may be acceptable to your visitors and it's easy to set up.


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.