For some taxes in the US like Medicare and Social Security, tax is 
collected at a certain rate only up to some income limit. For example, I 
would have to pay 6.2% social security tax for the first $147,000 I earn in 
2022, but I would not have to pay any social security tax for income over 
that amount. Similarly for Medicare, I have to pay 1.45% tax on all income, 
but for income above $200,000 I have to pay an addition 0.9% in Medicare 
taxes.

I would like to calculate the tax I owe in both of these scenarios. I'm 
using automatic transactions and virtual accounts to calculate my income 
tax liability in general, but in these particular cases I'm struggling with 
only calculating the tax up to a certain income amount or only taxing 
income above a certain amount.

I've tried something like this for the Medicare example, but it doesn't 
work as abs(O) is dealing with the transaction amount, and not the total 
balance of the account:
```
account Assets:Bank
account Income:Hooli

account Liabilities:Taxes:Medicare
account Liabilities:Taxes:Medicare:Additional

= expr "account =~ /Income:Hooli/ and abs(O)>200000"
    (Liabilities:Taxes:Medicare:Additional)     .009

= expr "account =~ /Income:Hooli/"
    (Liabilities:Taxes:Medicare)                .0145

2022-04-15 * Payroll
    Income:Hooli                               -150,000 USD
    Assets:Bank

2022-04-01 * Payroll
    Income:Hooli                               -150,000 USD
    Assets:Bank
```

Is there a way I can condition the automatic transactions based off the 
total account balance instead of the transaction amount?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/799a3b62-9124-44fe-a081-3ee31c6ee843n%40googlegroups.com.

Reply via email to