# Salary calcs for team members joining mid month

Hey everyone,

I’m working on a project where I need to calculate an employee’s salary based on their start date within a given month. I’m trying to determine the proportion of their salary for the month they started. Here’s a brief outline of what I’m doing, and I’d love to share my experience.

Here’s the approach I’m considering:

1. Helper Variable: I’m using the called `daysInMonth` helper variable to keep track of the number of days in the start month.
2. Example Calculation: Suppose an employee’s salary is \$10,000 and they start in March. I want to compute the salary for the partial month they’ve worked.
3. Formula: I’m planning to use the formula:
• `if day = start month, then start_day/ days_in_month * salary`.
• In other words, for the start day, I’d calculate the proportion of the month worked as:
``````Proportion = (start_day / days_in_month)
``````
• Then, apply this proportion to the salary to get:
``````Salary_for_start_month = Proportion * Salary
``````
1. Example: If the start day is 10 in March (assuming March has 31 days), the calculation would be:
``````Proportion = 10 / 31
Salary_for_start_month = (10 / 31) * 10,000
``````

Here’s an example for reference.

1 Like

Hey @vayun_causal - I’ve just implemented something similar and the final formula should be:

(days_in_month - start_day + 1) / days_in_month * salary

Otherwise you end up calculating the salary for the days before they started (i.e. first 10 days in March in your example above).

The +1 is needed to make it inclusive of start day in month (eg. if start day is 31/5, without the +1 the formula would be 0/31 for the employee’s salary on the last day of May).