Previous I wrote - How to display node count per taxonomy. Today I faced with problem to display node count for particular node reference field.
Scenario is like this: We have two content types: Destination, Hotel. Each hotel is referenced to specific destination by using node reference. We need to display how many hotels there are in all destinations.
To achieve such result, create a new View (content based), for example hotels
- Add node reference field, in our case - field_where
- Use aggregation: yes
- (field_where) Content: Title | Aggregation settings
- (field_where) Field: Background | Aggregation settings (Optional)
- Content: Category | Aggregation settings(Optional)
- COUNT(DISTINCT Content: Nid) | Aggregation settings
- Global: View result counter | Aggregation settings (Optional)
Live demo here: Hotels in Georgia