Report Grand Total Miscalculating Overtime

  • Thread starter Nancy via AccessMonster.com
  • Start date
N

Nancy via AccessMonster.com

I have a report based on a query that uses the following calculation in a
text box to calculate the total amount paid (including overtime) to an
employee:

=([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std Hours]>40, .5*
([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee Data_Rate]

This formula works perfectly to total individual weekly totals. However,
whenever I use the same calculation in the report footer to calculate the
grand total which sums up every employee for the week, the grand total is a
lot higher than it should be. For example, I hand computed the total amount
paid for a week and got 30,667.74 and the report is showing 50,951.88. I'm at
a total loss of what could be causing this. Any help would be greatly
appreciated!
 
D

Duane Hookom

...."whenever I use the same calculation in the report footer"...
Can you share the expression you tried? Was it:
=Sum(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std
Hours]>40, .5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee
Data_Rate])
 
N

Nancy via AccessMonster.com

Sorry, I should have explained better. I use the following formula in the
report footer

=Sum(([On Std Hours Totals]+[Off Std Hours Totals] + IIF([On Std Hours Totals]
+[Off Std
Hours Totals]>40, .5* ([On Std Hours Totals]+[Off Std Hours Totals]-40), 0)) * [Employee
Data_Rate])

The On and Off Std Hours Totals refers to text boxes in the report footer
that has the following formulas:

=Sum([On Std Hours])
=Sum([Off Std Hours])

I know this is the problem because the formula is calculating the total on
and off standard hours in the report footer instead of just summing up the
total that was paid. But I can't do a sum of the total paid because it
includes a sum. I've tried using a query as well but it won't work either.

Duane said:
..."whenever I use the same calculation in the report footer"...
Can you share the expression you tried? Was it:
=Sum(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std
Hours]>40, .5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee
Data_Rate])
I have a report based on a query that uses the following calculation in a
text box to calculate the total amount paid (including overtime) to an
[quoted text clipped - 14 lines]
a total loss of what could be causing this. Any help would be greatly
appreciated!
 
D

Duane Hookom

The initial expression you provided is apparently a group total. If this is
the case, you can probably duplicate the text box in the footer and set its
Running Sum to Over All. Give it a name like "txtHoursRunSum". Then add a
text box in the report footer with a control source of:
=txtHoursRunSum

--
Duane Hookom
Microsoft Access MVP


Nancy via AccessMonster.com said:
Sorry, I should have explained better. I use the following formula in the
report footer

=Sum(([On Std Hours Totals]+[Off Std Hours Totals] + IIF([On Std Hours Totals]
+[Off Std
Hours Totals]>40, .5* ([On Std Hours Totals]+[Off Std Hours Totals]-40), 0)) * [Employee
Data_Rate])

The On and Off Std Hours Totals refers to text boxes in the report footer
that has the following formulas:

=Sum([On Std Hours])
=Sum([Off Std Hours])

I know this is the problem because the formula is calculating the total on
and off standard hours in the report footer instead of just summing up the
total that was paid. But I can't do a sum of the total paid because it
includes a sum. I've tried using a query as well but it won't work either.

Duane said:
..."whenever I use the same calculation in the report footer"...
Can you share the expression you tried? Was it:
=Sum(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std
Hours]>40, .5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee
Data_Rate])
I have a report based on a query that uses the following calculation in a
text box to calculate the total amount paid (including overtime) to an
[quoted text clipped - 14 lines]
a total loss of what could be causing this. Any help would be greatly
appreciated!
 
J

John Spencer

You should probably use the exact same formula in the report footer as you are
using elsewhere. Assuming that you are referencing fields in the report's
record source, I would expect to see the following.

=SUM(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std Hours]>40,
..5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee Data_Rate])


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Sorry, I should have explained better. I use the following formula in the
report footer

=Sum(([On Std Hours Totals]+[Off Std Hours Totals] + IIF([On Std Hours Totals]
+[Off Std
Hours Totals]>40, .5* ([On Std Hours Totals]+[Off Std Hours Totals]-40), 0)) * [Employee
Data_Rate])

The On and Off Std Hours Totals refers to text boxes in the report footer
that has the following formulas:

=Sum([On Std Hours])
=Sum([Off Std Hours])

I know this is the problem because the formula is calculating the total on
and off standard hours in the report footer instead of just summing up the
total that was paid. But I can't do a sum of the total paid because it
includes a sum. I've tried using a query as well but it won't work either.

Duane said:
..."whenever I use the same calculation in the report footer"...
Can you share the expression you tried? Was it:
=Sum(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std
Hours]>40, .5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee
Data_Rate])
I have a report based on a query that uses the following calculation in a
text box to calculate the total amount paid (including overtime) to an
[quoted text clipped - 14 lines]
a total loss of what could be causing this. Any help would be greatly
appreciated!
 
N

Nancy via AccessMonster.com

Thank you both for taking the time to help me. It seems that I've run in to
the real problem and maybe one of you could help me with it. It seems that
I'm having problems because I am trying to do a Sum of a Sum in the report
footer. So, I created an expression in the query that my report is based on
to do the Sum for me. However, when I add the totals option to the query and
select sum underneath the On and Off Std Hours, it doesn't sum it up for me
in the report. It just shows the last entry. So, I tried to manually create
it by placing the following in a new field:

On Sum: Sum([On Std Hours])

When I try to run that I receive the following message:

You tried to execute a query that does not include the specified expression
'Supervisor' as part of an aggregate function.

I can select for the Supervisor field to not be shown and the error message
returns with the next field name in line. I've included my SQL code below.
Thanks in advance for any help you can offer. This is driving me insane!

SELECT [Weekly Data].Supervisor, [Weekly Data].Date, [Weekly Data].Day,
[Employee Data].[Current Pay Rate], [Employee Data].[Clock Number] AS
[Employee Data_Clock Number], [Weekly Data].[Job Change], [Weekly Data].
[Contract Number], [Employee Data].Employee AS [Employee Data_Employee],
[Operation Listing Data Field].[Unit Hour], [Operation Listing Data Field].
[Hour Unit], [Operation Listing Data Field].Rate, [Operation Listing Data
Field].Description, [Operation Listing Data Field].[Op Number], [Employee
Data].[Pay Rate], [Employee Data].Bonus AS [Employee Data_Bonus], [Employee
Data].[Current Pay Rate] AS [Employee Data_Current Pay Rate], [Weekly Data].
[Clock Number] AS [Weekly Data_Clock Number], [Weekly Data].Employee AS
[Weekly Data_Employee], [Weekly Data].[Hourly Rate], [Weekly Data].Bonus AS
[Weekly Data_Bonus], [Weekly Data].[Current Pay Rate] AS [Weekly Data_Current
Pay Rate], [Weekly Data].[Op Number], [Weekly Data].Description, [Weekly Data]
.Code, [Weekly Data].Contract, [Weekly Data].Rate AS [Weekly Data_Rate],
[Weekly Data].Quantity, [Weekly Data].[On Std Hours], [Weekly Data].[Off Std
Hours], Sum([On Std Hours]) AS [On Sum], Sum([Off Std Hours]) AS [Off Sum]
FROM [Operation Listing Data Field] INNER JOIN ([Employee Data] INNER JOIN
[Weekly Data] ON [Employee Data].[Clock Number] = [Weekly Data].[Clock Number]
) ON ([Operation Listing Data Field].[Op Number] = [Weekly Data].[Op Number])
AND ([Operation Listing Data Field].[Op Number] = [Weekly Data].[Op Number]);


John said:
You should probably use the exact same formula in the report footer as you are
using elsewhere. Assuming that you are referencing fields in the report's
record source, I would expect to see the following.

=SUM(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std Hours]>40,
.5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee Data_Rate])

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Sorry, I should have explained better. I use the following formula in the
report footer
[quoted text clipped - 26 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top