Drupal : Views 3 Aggregate settings for Group by

Like rest of you, I also can’t imagine any Drupal site without Views. No doubt, Drupal power relies in Views but with Views 2 we used to stuck with some advanced functionality, specifically to “Group by” elements.
But recently I got chance to explore Views 3 in depth and I found it extremely powerful than Views 2. In this Article, I’ll show you how to implement “Group By” with help of Views Aggregate function.
To explain this, Let’s take an example where we have one content type names as “songs” and it has below fields:

  1. song name
  2. album
  3. singer
  4. genre (blues, hip hop, dance, pop)
  5. description

Lets say we have 3 pop songs, 4 blues, 2 hip hop, 7 dance and none in sad. So I need to make a view which give me list of genre which have any song.
To achieve this, I need to set “Aggregation” on from views advanced settings.


After that, you can see “aggregate settings” tabs will started appearing for all fields. So now you need to select field on which you want to perform “group by” function, which is “genre” in my case.


I set Group column as “value” and that’s it. Now it will display list of genre which contain any song.
It was simple example to implement group by with the help of aggregate but we can do lot more than that with help of complete aggregate settings. I’ll share that “lot can do” stuff later with you.. so keep reading!!