# Calculate Tax After Deducting Deductions

By creating a salary component for Tax and checking ‘Variable Based On Taxable Salary’ the component is successfully calculated based on the Tax slabs configured in Payroll Period on all the total taxable salary (applied only on earning components).

The problem is that I want the tax to be applied after another salary component (social insurance) is deducted from the total salary.

I can do this if I write the formula in the Salary Structure manually but I’m trying to do it using Payroll Periods and Tax Slabs if possible.

An example equation to illustrate what I’m trying to do:
Net Pay = Basic + Housing + Transportation - Social Insurance - Tax
Tax should be (Basic + Housing + Transportation - Social Insurance) * 15%
What I’m getting is Tax = (Basic + Housing + Transportation) * 15%

Is there a way to do that?

I do have the same problem

@hamidaddin

Your correct calculation should be: ((Basic + Housing + Transportation) - Social Insurance) * 15%

Note that the earnings sum and social insurance deduction are in parenthesis which means that the sum of the earnings is derived in a first layer calculation and the social insurance is deducted in a second layer calculation. The sum of both calculations is what your tax is derived from.

I hope this solves your problem.

1 Like

Thanks a lot !!!

my background is in business management and procedures, I started using ERPNext 4 years ago. learned how to used myself… but just now decided to go full on it. I will be around here trying to help.

Again, Thanks !

Hi,
Are you able to clear your issue?