Need help in creating a custom calculation of percentage

hitek6456

New Member
I have an element with two option Yes or No. Yes = 1 and No =0 I want to create a custom calculation to be able to determine the percentage of Yes. I placed the following code in the custom calculation section in the split custom field.

PHP Sample:
return count($data) < 0 ? array_sum($data) / count($data) : 0;

Any help would be greatly appreciated :)
 
Would it not be easier just to put "AVG(%s)" in the Custom Query field?

If you are wanting to split (group?) your data, then I guess the calc is approximately right (though I think that the < should be a >).
 
All I want is to create a query to determine the percentage of yes. Thanks for the reply . I'm new at this but i love Fabrik. The possiblities are endless.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top