Hello everyone,
I have a table set up to calculate sales commissions based on revenue, and I’m working with two different commission tiers:
Revenue up to $500,000 is calculated at 3%
Revenue above $500,000 is calculated at 5%
For example, if a salesperson generates $565,000 in revenue, the commission should be calculated as follows:
$500,000 × 3% = $15,000
$65,000 (the amount above $500,000) × 5% = $3,250
Total commission = $15,000 + $3,250 = $18,250
I’m a bit confused about how to structure this calculation logic in Glide Tables. Can someone please guide me on how to implement this properly?
Thanks in advance!
I would use a JavaScript column:
if (p1 <= 500000) { return (p1 * .03) }
let excess = p1 - 500000;
return (15000 + excess * .05)
Note that the JavaScript column returns a string, so if you needed to use that in any subsequent calculations, you would first need to use a math column to coerce it to a number.
2 Likes
Could be something like this in a math column:
MIN(R,500000)*0.03
+
MAX(0, R-500000)*0.05
4 Likes
Sorry for not mentioning it in detail earlier.
I’d like to display something like the image I’ve uploaded. The idea is to support different commission percentages for different groups of salespeople — or even custom rates for individuals. Now, instead of hardcoding these percentages, I want the frontend to show a similar breakdown for each salesperson, based on their group or individual commission settings.
1 Like
Mehmet_Karaja:
I’d like to display something like the image I’ve uploaded. The idea is to support different commission percentages for different groups of salespeople — or even custom rates for individuals. Now, instead of hardcoding these percentages, I want the frontend to show a similar breakdown for each salesperson, based on their group or individual commission settings.
So have you got the logic figured out? I assume by custom, you mean the percentages up to 500k and above 500k is different for each person?
If that’s the case, you can just have two percentage values for each person, and then calculate the Commission up to 500k/above 500k for each person.
Then, display the info above in a table/data grid.
2 Likes
I was actually looking for this formula to use in a Math column, and it solved the problem perfectly:
For the amount above 500K: max(revenue - 500000, 0) * [Column Name]
For the amount up to 500K: min(revenue, 500000) * [Column Name]
Thanks everyone for your help and time!
2 Likes