Community Documentation

Views Calc

Last updated March 29, 2009. Created by KarenS on January 16, 2009.
Edited by quicksketch. Log in to edit this page.

Turn a normal table like:

into this:

Instructions:

  1. Create a view and add fields to it as you normally would. Start by creating a normal table and make sure that works as you expect.
  2. Change the style type from 'table' to 'Views Calc table'.
  3. In the Views Calc table settings, mark which fields need calculations.

  4. Save the view.

Comments

Field...

What may I do to have fields like the examples:
Content: Date
Content: Rank
etc.

I've tried to add a kind of field "content" but i didn't find it ¿?
It may be obvious but i don't know how to do it.

Show details

I assume by content you mean the body of the post...

The style options include the tick box "show details"

Totals by group

How do we create sub-totals by group

Lets say we have a table showing: school; number of volunteers

This is grouped by 'programme'

How do I get a sub-total for each programme - at the moment it just repeats the totals at the end of each group?

Great Question...

Wondering the same thing ..
Looking into going about an approach here: admin/settings/views_calc

Any progress on your end mylesorme? (or anyone else?)

Hi I have a table with several fields and grouping option. When I switch to Views Calc Table I get:
warning: Invalid argument supplied for foreach() in .....sites/all/modules/views_calc/theme.inc on line 178.

Is there any patch for this?
Thanks,
K.

Similar - seems specific to Date fields

Hi there.

I seem to get a similar error - when using a Date field. (might be Date-specific ?)

SiteMaster.ServeLime
Always Make a Positive Difference
Servelime.com

Echo that

I get the same error. I think I had enabled a relationship in one view and later took it out but the error remains.

Same thing for me...

"warning: Invalid argument supplied for foreach()"…
Is it working with computed fields?

foreach() error

it went away for me once I created a calculated field in the view

Row titles?

In your example it shows a title for the calculated row like Count: 6 or Max: 15 How do I get this when I am calculating a row all I get is the value?

Balance sheet

Hi,

is it possible to create a balance sheet with views calc; subtracting expenses from income?

Chris

subtracting one sum from another sum

I would need the same thing: Calculate the sum of one column=A, calculate the sum of another column=B and have a "grand total" (C=A-B) displayed. Possible?

multiple pages view

How does this work when the view is configured to be displayed in several pages (as in maximum 10 entries displayed per page but there's over 100 entries alltogether)? Will the calculations be based on all 100+ entries or only those 10 entries displayed at that time?

Example for calculation field?

As seen at: admin/settings/views_calc

Anyone have an example of what can go in the calculation field?

Same for the custom function.

Block Display

Is it possible to display calc results in a block? e.g. without the items being added being shown? For example, Projects are buildings that save energy. I can make a table showing total savings, but can I make a block to display only the total?

Block Display

@kevinkpierce: Hi, any luck on creating a total in a block display. I am more or less looking for the same but then in combination with the option to select certain nodes in a view and get a total from that.

Regards, Paul van Erk [Stream]

You have to uncheck "show

You have to uncheck "show details" (don't remember if it's the exact phrase.

Chris
http://www.neuros.fr

About this page

Drupal version
Drupal 6.x
Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.