This project is not covered by Drupal’s security advisory policy.

This views style plugin displays the results of a view as a crosstab (also commonly called a pivot table) - grouping rows by one field, columns by another, and using an aggregate function (count, sum etc) of a third field for the table data.

For example, this module will take a table view with linear output like:

User Content Type Node ID
Anita Blog 1
Anita Page 3
Barak Page 5
Jamila Blog 2
Jamila Blog 4
Jamila Page 6

And turn it into a crosstab that counts the number of each type of content for each author:

User Blog Page Total
Anita 1 1 2
Barak 1 1
Jamila 2 1 3

A default view "content type count by user" that does just this is included with this module.

Security note: A security vulnerability was discovered and has been fixed. Users of previous versions are strongly advised to update to version 6.x-1.0-alpha2 or higher, 7.x-1.0-alpha1 or higher, or a dev release dated on or after November 14, 2013.

Usage notes:

  • The 7.x branch is actively being supported.
  • The 6.x branch is currently not seeing new development, except for security patches. If you are interested in working on backporting 7.x patches, developing for 6.x, or reviewing 6.x, please post a Support Request in the issue queue offering your help.
  • Because Views Crosstab modifies the SQL created by your view, it may be possible to produce SQL errors with this module, especially with very complex views or other modules which modfy the views query, such as Views Group By. Examining the previewed SQL when building your view and understanding SQL will help you your issues. If you have a view which you believe that Views Crosstab should reasonably support, post a bug report in the issue queue.

Related modules:

  • Views Pivot - a very similar module which performs the crosstab at the theme rather than database layer. No 6.x version. If Views Crosstab does not meet your use case, try Views Pivot.
  • Views Group By - allows grouping an aggregation of fields (useful for lots of things!), but does not allow a crosstab of 2 fields against each other.
  • Views Calc - allows multiple column oriented aggregates to be added, as well as providing additional formatting control.
Supporting organizations: 
Initial development

Project information

Releases