### Post

2 followers Follow

# Percentage Calculation

Hello,

I am trying to show percentages in my calculations.

For example, we have X clients. They need to be 100%

X of those clients are Active

X are Closed

How do I make a calculation to show a percentage in Podio.

Thank you.

Natalie N.

Hi Natalie,

do you need to count active, closed and total number of clients first or do you already have that numbers?
If you already have that numbers, here an example:

var total = 200;
var active = 25;
active / total  * 100

result is 12.5.

If you need to count them first all clients should be related an app with one item. Then in that item ("Status" stand for the field where you mark them as "Active" or "Closed", replace Status with the real name of that field):

var status = @All of Status;
var total = status.length;
var active = status.filter(function (i) {return i == "Active";}).length;
var closed = status.filter(function (i) {return i == "Closed";}).length;

Then you can calculate the percentage.

active / total  * 100
or
closed / total  * 100

Rainer

Rainer Grabowski 1 vote

Thank you Rainer!

I did this:

(@All of Status.filter(function(i){return i =="Active";}).length/@All of Status.length)*100;

(@All of Status.filter(function(i){return i =="Closed";}).length/@All of Status.length)*100;

It is telling me this:

The result is not a valid number. Will keep working on it.