vj5 Posted March 7, 2008 Share Posted March 7, 2008 Can someone help with the following calculation in php:Base is 2, Current is 2 so Retention rate is 100%Base is 2, current is 3 so Retention rate is 102 %How will I calculate this in programming language(php)? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 7, 2008 Share Posted March 7, 2008 .. how do you calculate the retention rate? Is that what you're trying to calculate? What is the formula for it? Is the base a radix, a number base, like binary, octal, decimal, hexadecimal, etc? Link to comment Share on other sites More sharing options...
vj5 Posted March 7, 2008 Author Share Posted March 7, 2008 .. how do you calculate the retention rate? Is that what you're trying to calculate? What is the formula for it? Is the base a radix, a number base, like binary, octal, decimal, hexadecimal, etc?I don't know the formula . I am doing a growth report on php and the report says, base is 2, current is 2 and retention rate is 100%. Based on said, I need to calculate the retention rate. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 7, 2008 Share Posted March 7, 2008 You need to know the formula, or you need more information then only that. It could be base * 50. It could be current * 50. It could be base / current. It could be base * 50 + (current - 2). It could be base * 50 + ((current - 2) * 2). It could be anything. There's not enough information to determine what the relationships between the variables are. Link to comment Share on other sites More sharing options...
vj5 Posted March 7, 2008 Author Share Posted March 7, 2008 You need to know the formula, or you need more information then only that. It could be base * 50. It could be current * 50. It could be base / current. It could be base * 50 + (current - 2). It could be base * 50 + ((current - 2) * 2). It could be anything. There's not enough information to determine what the relationships between the variables are.okay, thanks. will get more info. Link to comment Share on other sites More sharing options...
vj5 Posted March 10, 2008 Author Share Posted March 10, 2008 The base is number of people started their enrollment and current is how many people are still in the enrollment. Here is my calculation:sample of rr :Base is 2 Current is 2 rr = 100%base 5 current 0 rr = 0.00%base 1 current 0 rr = 0.00%base 5 current 4 rr = 80.00%if base == 0 {rr = "100%"}else {rr = base/current * 100}I am not getting an answer for the above calculation. Can someone please help? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 10, 2008 Share Posted March 10, 2008 It should be current/base, not base/current. Also before you do that make sure that base is not 0, if it is then you'll get an error. Link to comment Share on other sites More sharing options...
vj5 Posted March 10, 2008 Author Share Posted March 10, 2008 It should be current/base, not base/current. Also before you do that make sure that base is not 0, if it is then you'll get an error.Thanks, I got it right. How will I add all the base together to get a sum? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 10, 2008 Share Posted March 10, 2008 With the + operator. Link to comment Share on other sites More sharing options...
vj5 Posted March 10, 2008 Author Share Posted March 10, 2008 With the + operator.here is my code:$totalbase = $arrBroker['base'] + $arrBroker['base'];it is not showing the correct sum. how do I do this? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 10, 2008 Share Posted March 10, 2008 Well, I guarantee that code will set $totalbase to be $arrBroker['base'] * 2, which is what you're telling it to do. If you have some sort of a loop where you are going through everything then you initialize a variable to 0 before the loop and add each value to it as you go through. Link to comment Share on other sites More sharing options...
vj5 Posted March 10, 2008 Author Share Posted March 10, 2008 Well, I guarantee that code will set $totalbase to be $arrBroker['base'] * 2, which is what you're telling it to do. If you have some sort of a loop where you are going through everything then you initialize a variable to 0 before the loop and add each value to it as you go through.Thankyou. I got it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.