Rounding Over a Set of Rows
March 16, 2005 Michael Sansoterra
The code for this article is available for download.
Sometimes, a seemingly simple thing like rounding can present thorny issues. This is particularly true when the rounding has to take into account an arbitrary number of values. To illustrate, consider the example of a retail point-of-sale application that requires the rounded state sales tax and local sales tax to be recorded at the sales line level instead of at the header level.
This can get tricky because the rounded tax amount calculated at the header may not equal the sum of the tax amounts calculated against the line as