Previous x months base_net_pay in Salary Structure formula

Hi

Is it possible to access the previous 2 months base_net_pay in the salary structure formula ?

Use Case:

Here 1600, the first employer contribution is calculated as 8000 + 12000 + 12000 = 32000 * 5% = 1600.

Note: Can’t use year_to_date or annual_taxable_amount as the joining date can cross over the payroll period.