gonzalo123 / gam-pivot

Pivot tables with PHP
http://gonzalo123.wordpress.com/2010/01/24/pivot-tables-in-php
28 stars 15 forks source link

Need Percentage Calculation #1

Open evan06alam opened 10 years ago

evan06alam commented 10 years ago

Dear Brother, I need percentage calculation for this gam-pivot on right column after total on line by line and grand total percentage.

gonzalo123 commented 10 years ago

Percentage is calculation that depends on the particular data that you are using. Because of that the library cannot do it. To implement this kind of custom operations you need to use Pivot::callback. You can see how to implements the example the 'average' calculation. The percentage is similar

evan06alam commented 10 years ago

problem

I got the original table from an array. I found this result form my table using this great library. I need new column on right. I do not understand how to generate? And what is the variable of total & count column.

I very new in php. I understand very little about class. Would you please help me to solve this problem. I need percentage of total on right like this theory, (total * count )/100 on right column.

is it possible?

gonzalo123 commented 10 years ago

I've trying to change a little bit the library and add some improvements (like percentage) but this's a quite old library without any integration test or things like that and that's too hard. It throws dozens of warnings because arrays aren't initialised. I prefer to start a new project with tests to allow to do this kind of things without suffering.

evan06alam commented 10 years ago

Thanks for you response, do you have any progress regarding percentage. I need it badly.