• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

Cannot get the percentages to equal 100

Hello - I've worked on this for a rediculous number of hours....I have a report that calculates the monthly percentages of incidents by incident type.  I calculate the percent and store it in a field that has a Number data type, field size of 'Double', a format of 'General Number' and a Decimal places = 2.   I do round the percent calculation and it looks like this:
Round(([rstTotalInc].Fields(2) * 100) / varTotalIncYear1, 3)
On the report, the percentage fields Format is set to Auto for Decimals.

The problem is that when I total the percentages, I cannot get them to equal 100 unless I allow the field on the report to go to 3 decimals.  Even then sometimes it sums to 99.999.  I've tried rounding, not rouding, changing the data type, etc.  I would like the percentages for each incident type to be percentages with no numbers to the right of the decimal and to have the same format for the total percentage and I would like it to equal 100.  Any help would be most appreciated.  Thank you.
0
DataTransformationServices
Asked:
DataTransformationServices
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
yes, that is a problem.

say you have 3 rows with the values 1 , 1 and 1. total is 3. perc for all 3 rows is 33.33333333333 % ..
no matter how many digits you put, you won't be able to sum up to 100%.

this must be known to all those checking percentages, that the percentages are NOT to be summed, unless (at least 1) of the resulting percentages is "recalculated" to be the 100% - sum( of all the other percentages displayed ), however, then, that percentage value does not 100% match the actual calc, aka 33.34 vs 33.33 for example.

you CANNOT solve that issue.
0
 
DataTransformationServicesAuthor Commented:
Thank you for your response.  I somewhat had a feeling that would be the case but it is being done in Excel.   In the Excel spreadsheet, the numbers are rounding and the total is 100 by summing the individual percents.  Any idea why it works there?
0
 
Luke ChungPresidentCommented:
Don't use the Round function in the expression.

Use the format property of the text box to control how it's displayed. Round will change the value.

That way the control keeps the full "real" value and when you sum it up, you'll get the 100%.

Hope this helps.
0
 
DataTransformationServicesAuthor Commented:
Thanks so much, I did remove the rounding and use the Format command and it still comes out to 99.99999.  I guess I will have to give the user the ability to edit these values to equal 100.  Thanks again.
0
 
Luke ChungPresidentCommented:
You shouldn't have to edit anything.  If your report has a format setting to a fixed number of decimals, that'll appear as 100.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now