# Distribution coefficient

#### dNy

##### New member
Hey guys,

Thanks a lot for you help!

I'm building a financial app and I need some help with making a "distribution coefficient/index" (best math name I could give it ). The idea behind it is:

- There's a total balance. Let's call it "X".
- There are users with different shares at stake on "X": A, B, C and D (users).
- Each user has a % allocation depending on how much they have at stake on "X". Let's say:
- A --> 10 units --> 10%
- B --> 20 units --> 20%
- C --> 30 units --> 30%
- D --> 40 units --> 40%
X = 100 ---> 100%

I need a coefficient (let's call it "Y") capable of determining the new allocation % of each user once any of them has added more units to "X", and the formula to calculate this coefficient. It would be something like:

oldUnits + newUnits
- A --> 30 (10 + 20) --> Y --> 25%
- B --> 20 --> Y --> 16.66%
- C --> 30 --> Y --> 25%
- D --> 40 --> Y --> 33.33%

The limitations/constraints/requirements/etc. are:

- The only parameter that I (my app) can freely modify is "Y".
- The users are in charge of modifying their own stake of "units".
- The % allocation is the result of the interaction of "units" with "Y" and it must return 100% when adding up the % allocation of all users.

I don't have any high-level math background (mine it's business), so go easy on me please.

Thanks a lot again for your help!

Cheers.

#### BigBeachBanana

##### Full Member
You just need to do a new total every time people contribute to the pool. Then take # units each person owns and divide by the new total pool.