# How does Rounding with SalesTaxII work?

## Overview

You want to know how the rounding logic in SalesTaxII works

SalesTaxII

## Resolution

The rounding routine in SalesTax II is a complex and deeply embedded issue. The application performs a series of calculations for each invoice line item (one calculation per jurisdiction per invoice line). If there was only one calculation per invoice (the invoice subtotal * combined tax %) it would be easy to round the calculated tax amount,  but in the program we have to account for multiple jurisdictions. It’s not uncommon to have 5 or more jurisdiction calculations for each line of an invoice.

Here is an example that helps illustrate some of the the complexities.

Taxable Amount:             1528.42

State Tax                             4%

County Tax                          4%

1528.42 * .08 (combined rate)    = 122.2736 (Not a rounding situation)

1528.42 * .04 (State)     = 61.1368

1528.42 * .04 (County)  = 61.1368

61.1368 + 61.1368   = 122.2736. (same as combined calculation above)

61.13      + 61.13     = 122.26      --> If we didn’t round this would be a penny under.

61.14      + 61.14     = 122.28      --> If we rounded both, we’d be a penny over.

In the Sales Tax II  Tax Accumulator file, taxes are stored at a jurisdictional level for each invoice, so that we know who to pay what to. So now we have a penny we need to allocate, who would get the penny, the state or the county?

Even if we could round that individual transaction correctly there still is still the problem where a tax amount on an individual invoice line ends up as a .XX5 transaction, if we round up that transaction up, and there are 10 lines on an invoice where that situation arises, then the final invoice could potentially be \$0.05 over.

Accordingly, a decision was made years ago to always round down. The logic being that our customers would receive fewer complaints if their customer received an invoice where the taxes were a few cents short as opposed to a few cents over.

Avalara is aware that this rounding algorithm does not work well for some of our customers. It is an issue that is high on the list of enhancements that we wish to address in a future release.