Sharing amounts by ratio

I am making an app where I have staff attend to customers for service. The staff are paid on commission (different commission for each staff). And because a combination of any number of staff can provide any service, I need an expression to share the commission based on their percentage ratio.

I have tables for service, service details and staff commission. Each service has several details and several staff. I am able to calculate the commission based based on each staff percentage and divided it by number of staff to have commission to be paid to the staff. However, sharing the commission to the staff based on the ratio of the percentage is proving difficult. It will be the individual staff percentage divide by the total of percentages for staff involved, multiply by the commission. I need help!

1 Like