Views aggregation, sum of node count in _each row_ I have a View that uses aggregation to count the number of nodes of a custom color type. For example, there are 10 red nodes, 10 green nodes and 20 blue nodes. For each color, I would want it's node count and the total count to show up on each row, like this:

Color    Count   Total
Red       10      40
Green     10      40
Blue      20      40


Ultimately, I do want to calculate the percentage in each row as well, but for now I'd just like the total.

What's the most efficient "drupal" way of doing this?
A no-custom-code solution could be something like this (not the most performant way though but you could perhaps do something with views caching). 

Explanation:
Create one view for the total count that with the use of aggregration and a content type filter returns the total number of nodes (the Total column)
In another Taxonomy Terms view you attach the total count view by adding a Global: View field that is provided by the Views Field View module   

Steps
 - Create a content type e.g. "Colornode"
 - Create a taxonomy vocabulary called "Colors"
 - Add three terms Blue,Green and Red
 - Add a term reference field and select Colors as the vocabulary
 - Install and enable the Views Field View  module

Then import these two views in this order:

$view = new view();
$view-&gt;name = 'nodecounts';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'node';
$view-&gt;human_name = 'Node counts';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['title'] = 'Node counts';
$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
$handler-&gt;display-&gt;display_options['group_by'] = TRUE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['query']['options']['query_comment'] = FALSE;
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'none';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
$handler-&gt;display-&gt;display_options['style_options']['default_row_class'] = FALSE;
$handler-&gt;display-&gt;display_options['style_options']['row_class_special'] = FALSE;
$handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
$handler-&gt;display-&gt;display_options['row_options']['inline'] = array(
  'type_1' =&gt; 'type_1',
  'type' =&gt; 'type',
);
$handler-&gt;display-&gt;display_options['row_options']['separator'] = ': ';
/* Field: Content: Type */
$handler-&gt;display-&gt;display_options['fields']['type_1']['id'] = 'type_1';
$handler-&gt;display-&gt;display_options['fields']['type_1']['table'] = 'node';
$handler-&gt;display-&gt;display_options['fields']['type_1']['field'] = 'type';
$handler-&gt;display-&gt;display_options['fields']['type_1']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['type_1']['exclude'] = TRUE;
$handler-&gt;display-&gt;display_options['fields']['type_1']['element_label_colon'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['type_1']['element_default_classes'] = FALSE;
/* Field: COUNT(Content: Type) */
$handler-&gt;display-&gt;display_options['fields']['type']['id'] = 'type';
$handler-&gt;display-&gt;display_options['fields']['type']['table'] = 'node';
$handler-&gt;display-&gt;display_options['fields']['type']['field'] = 'type';
$handler-&gt;display-&gt;display_options['fields']['type']['group_type'] = 'count';
$handler-&gt;display-&gt;display_options['fields']['type']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['type']['element_label_colon'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['type']['element_default_classes'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['type']['separator'] = '';
/* Filter criterion: Content: Type */
$handler-&gt;display-&gt;display_options['filters']['type']['id'] = 'type';
$handler-&gt;display-&gt;display_options['filters']['type']['table'] = 'node';
$handler-&gt;display-&gt;display_options['filters']['type']['field'] = 'type';
$handler-&gt;display-&gt;display_options['filters']['type']['value'] = array(
  'colornode' =&gt; 'colornode',
);

/* Display: Block */
$handler = $view-&gt;new_display('block', 'Block', 'block');


And the second one:

$view = new view();
$view-&gt;name = 'colorterms';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'taxonomy_term_data';
$view-&gt;human_name = 'Color terms';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['title'] = 'Color terms';
$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
$handler-&gt;display-&gt;display_options['group_by'] = TRUE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'full';
$handler-&gt;display-&gt;display_options['pager']['options']['items_per_page'] = '100';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'table';
/* Relationship: Taxonomy term: Content using Color */
$handler-&gt;display-&gt;display_options['relationships']['reverse_field_color_node']['id'] = 'reverse_field_color_node';
$handler-&gt;display-&gt;display_options['relationships']['reverse_field_color_node']['table'] = 'taxonomy_term_data';
$handler-&gt;display-&gt;display_options['relationships']['reverse_field_color_node']['field'] = 'reverse_field_color_node';
/* Relationship: Content: Color (field_color) */
$handler-&gt;display-&gt;display_options['relationships']['field_color_tid']['id'] = 'field_color_tid';
$handler-&gt;display-&gt;display_options['relationships']['field_color_tid']['table'] = 'field_data_field_color';
$handler-&gt;display-&gt;display_options['relationships']['field_color_tid']['field'] = 'field_color_tid';
$handler-&gt;display-&gt;display_options['relationships']['field_color_tid']['relationship'] = 'reverse_field_color_node';
/* Field: Taxonomy term: Name */
$handler-&gt;display-&gt;display_options['fields']['name']['id'] = 'name';
$handler-&gt;display-&gt;display_options['fields']['name']['table'] = 'taxonomy_term_data';
$handler-&gt;display-&gt;display_options['fields']['name']['field'] = 'name';
$handler-&gt;display-&gt;display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['name']['alter']['ellipsis'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['name']['link_to_taxonomy'] = TRUE;
/* Field: COUNT(Content: Color) */
$handler-&gt;display-&gt;display_options['fields']['field_color']['id'] = 'field_color';
$handler-&gt;display-&gt;display_options['fields']['field_color']['table'] = 'field_data_field_color';
$handler-&gt;display-&gt;display_options['fields']['field_color']['field'] = 'field_color';
$handler-&gt;display-&gt;display_options['fields']['field_color']['relationship'] = 'reverse_field_color_node';
$handler-&gt;display-&gt;display_options['fields']['field_color']['group_type'] = 'count';
$handler-&gt;display-&gt;display_options['fields']['field_color']['label'] = 'Count';
$handler-&gt;display-&gt;display_options['fields']['field_color']['separator'] = ', ';
/* Field: Global: View */
$handler-&gt;display-&gt;display_options['fields']['view']['id'] = 'view';
$handler-&gt;display-&gt;display_options['fields']['view']['table'] = 'views';
$handler-&gt;display-&gt;display_options['fields']['view']['field'] = 'view';
$handler-&gt;display-&gt;display_options['fields']['view']['label'] = 'Total';
$handler-&gt;display-&gt;display_options['fields']['view']['view'] = 'nodecounts';
$handler-&gt;display-&gt;display_options['fields']['view']['display'] = 'block';
/* Filter criterion: Taxonomy vocabulary: Machine name */
$handler-&gt;display-&gt;display_options['filters']['machine_name']['id'] = 'machine_name';
$handler-&gt;display-&gt;display_options['filters']['machine_name']['table'] = 'taxonomy_vocabulary';
$handler-&gt;display-&gt;display_options['filters']['machine_name']['field'] = 'machine_name';
$handler-&gt;display-&gt;display_options['filters']['machine_name']['value'] = array(
  'colors' =&gt; 'colors',
);
/* Filter criterion: Content: Type */
$handler-&gt;display-&gt;display_options['filters']['type']['id'] = 'type';
$handler-&gt;display-&gt;display_options['filters']['type']['table'] = 'node';
$handler-&gt;display-&gt;display_options['filters']['type']['field'] = 'type';
$handler-&gt;display-&gt;display_options['filters']['type']['relationship'] = 'reverse_field_color_node';
$handler-&gt;display-&gt;display_options['filters']['type']['value'] = array(
  'colornode' =&gt; 'colornode',
);

/* Display: Page */
$handler = $view-&gt;new_display('page', 'Page', 'page');
$handler-&gt;display-&gt;display_options['path'] = 'color-terms';
$handler-&gt;display-&gt;display_options['menu']['type'] = 'normal';
$handler-&gt;display-&gt;display_options['menu']['title'] = 'Color terms';
$handler-&gt;display-&gt;display_options['menu']['name'] = 'main-menu';

/* Display: Page */
$handler = $view-&gt;new_display('page', 'Page', 'page_1');
$handler-&gt;display-&gt;display_options['path'] = 'color-terms';
$handler-&gt;display-&gt;display_options['menu']['type'] = 'normal';
$handler-&gt;display-&gt;display_options['menu']['title'] = 'Color terms';
$handler-&gt;display-&gt;display_options['menu']['name'] = 'main-menu';


Result