1

I use Views Aggregator Plus to calculate sum of a column.

items    data
A         20
B         40
C         10
____________
Total     70
Then I want to add additional column for percentage.

-----------------------------------------
Item        Data        Percentage 
-----------------------------------------
A              20 
B              30
C              50
-----------------------------------------
                100
----------------------

I know Global:Math expression. But I don't know how to get the sum, the sum field(Total) is not available. Only [value], [value_1] and [value_2] available for A, B and C respectively.

Is there a way to add a percentage column?
I have seen this question in another page with unclear answer.

2
  • Check this out drupal.stackexchange.com/questions/73481/… – Bala Dec 8 '15 at 9:15
  • Thanks Bala, but I don't see how using aggregation can help this situation. I need to use this Total sum in other calculations, Is it possible this way? Please give more details, Thanks – Maryam Dec 8 '15 at 18:18
0

Use php_view module to add column to calculate the percentage

$field_one = 50;
$field_two = 350;

$new_column = ($field_one / 100) * $field_two;
2
  • and how you get all the values to make the sum? – Adrian Cid Almaguer Dec 8 '15 at 6:13
  • Exactly, so the real question is how do we get total sum of a views field without views_calc? – Maryam Dec 8 '15 at 15:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.