Grand Total for Columns

pkjoshi

Active Member
I am using sum the column total with split on. Now I want a Grand total without split at the bottom of the table.

I think the custom calc may help me achieve this, but I can't figure out how can use it to have the grand total of a column at the bottom of the list.
 
I am using sum the column total with split on. Now I want a Grand total without split at the bottom of the table.

I think the custom calc may help me achieve this, but I can't figure out how can use it to have the grand total of a column at the bottom of the list.

Hmmm...U mean u want both total sum AND splitting sum for the same column, at the same time, correct?

One way is to do it with the custom calc by writing something like

Code:
 $result = (int)'{Sum__element_name}'
return (int)$result;
 
Try return (int)'{Sum___element_name}';
And set 'Ajax calculation" to "Yes" so you get the totals in realtime.
 
What you are suggesting is totally different then what I want.

I have my calculations sum split on group for most of the columns. Now I want the sum of this sums or you can call sum of columns without split at the bottom column(element).
 
You could use a custom template to calculate and display the total.

If the database table contains the values you can do
$db=&..;
$q= "SELECT SUM(xxx)...";
...
echo ...;
If you want only to sum the sums displayed on the actual page I don't know how to get the values (but it should be possible as they are displayed)
 
Troester thanks for your suggestion.
I need little more elaboration how I can do it with custom template. where I need to put that code.
Actually I can replicate the sum field with custom calc i.e. custom calc is also returning the sum of the column.

Problem I am facing is If I have selected calculation sum to be split on a element say "firm" then even with custom calc I must use split on otherwise the result doesn't show-up.
 

Attachments

  • grant-total.PNG
    grant-total.PNG
    11.6 KB · Views: 477
ive altered the code @github so the total is also shown when split. For those who don't want that it has a class so it can be easily styled via css

-Rob
 
Hi Rob, I think I have not clearly explained what I want. As there is a option for sum in calculations for the columns, I am using the calculations sum with the option split on a particular field.

Now since the sum is split on group, I also want a grant total i.e. the sum of the values in the column in addition to the sum for the split group.

I have tried to achieve the same using the custom calc that using the sum field as split on a field and using the custom calc without using the split option so that I can achieve the result I expect, but the custom calc works fine if I use the custom calc also as split option otherwise it simply doesn't work.
The attached image will explain what I expect and what I am getting.
 

Attachments

  • grant-total.PNG
    grant-total.PNG
    21.2 KB · Views: 742
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top