Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Calculations

Status
Not open for further replies.
Jul 3, 2000
20
US
I am working in a report and grouping by date.

This sounds really dumb but if I calculate a sum to a date, in this case two parameters: bundles and hours. I obviously obtain two totals. If I create two variables (bund_tot and hour_tot)to obtain the same totals, they match. In this case, 3 records total bundles to 552 and hours to 6.48. But if I use the variables and divide bund_tot by hour_tot the result is incorrect! The report shows 85.14 but the real total is 85.19. Do I need to pre-calculate the totals before I run the report? Why even have totals if the numbers don't work???? Any ideas would be helpful.
 
I have also had a similar problem to this a long time ago.
I think I used the SET DECIMALS to 2 command and made sure the fields in the report were stretched to cover 2 decimal places.
It may sound odd but this cured the problem as I remember.
 
Thanks but that doesn't help. I think I'll just have to run this report from a query rather than a table.
 
My 2 cents.
Other then some very simple column totals I (almost) always do the needed calculations in fox code in a temp table/query before passing it on to the report to print. I guess I like to see the data in a brower while developing etc. before sending it to a printer. Besides then I can send the data to EXCEL, HTML etc etc if the user needs it.

Lion Crest Software Services
Anthony L. Testi
President
 
Show us the 3 records (bundles and hours for each record)
Also show the incorrect report output for bundles/hr and what you consider to be the correct answer
 
What I finally did was to allow the report to sum the total to a variable. I then took that variable and made it into a string and then back to a value. val(str(variable,10,2)) this made the numbers consistent.

thanks for all your suggestions.
 
You can't trust your workaround
Supply the values for the 3 records as I requested
 
Cricket is right, without seeing the numbers, we can only guess at the actual issue and any suggested solutions would be guesses too. My guess us that by using VAL(STR(variable,10,2)) you are in effect rounding the numbers. Apparently one method is rounding (or truncating) and the other method isn't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top