Trying to show Subtotal for calculated field in report (1 Viewer)

David Ball

Registered User.
Local time
Tomorrow, 07:34
Joined
Aug 9, 2010
Messages
230
Hi,
I have a Report with Planned Hours and Actual Hours fields that is grouped by Project and then Discipline.
In the Discipline Footer I have text boxes that show the totals for Planned Hours , with formula =Sum([PHours]), and Actual Hours, with formula =Sum([AHours]).
I also have another textbox (Text33) which adds the results from the other two, with formula =[Sum Of PHours]+[Sum Of AHours].

In the Project Footer I have text boxes that show a total for each project. This works fine for the PHours and AHours , with formulas =Sum([PHours]) and =Sum([AHours]). The problem I am having is trying to get the total for the combined values of PHours and AHours. I have tried =[Sum Of PHours]+[Sum Of AHours] but it doesn’t give the correct results.
How can I show a sub total for totals that are derived from a calculated field like this?
Thanks very much
Dave
 

JHB

Have been here a while
Local time
Tomorrow, 00:04
Joined
Jun 17, 2012
Messages
7,732
.. I have tried =[Sum Of PHours]+[Sum Of AHours] but it doesn’t give the correct results.
What result does it give then?
Is [Sum Of PHours] and [Sum Of AHours] the name of the controls for Sum([PHours]) and Sum([AHours])?
 

isladogs

MVP / VIP
Local time
Today, 23:04
Joined
Jan 14, 2017
Messages
18,216
Does it always give the wrong answer or just when one of PHours or AHours is blank?

If the latter, try using

Code:
=Nz([Sum Of PHours],0)+Nz([Sum Of AHours],0)
 
Last edited:

David Ball

Registered User.
Local time
Tomorrow, 07:34
Joined
Aug 9, 2010
Messages
230
It is grouped first by Project and then Discipline. Not every project has the same number of disciplines (Electrical, Mechanical, Painter, etc). Whichever discipline is last (at the bottom) the value for that discipline for PHours plus AHours shows up in the Subtotal text box, not the sum for all disciplines.
I can't just add the Subtotals for AHours and PHours because I only want results where there was a value for both and this is not always the case.
 

isladogs

MVP / VIP
Local time
Today, 23:04
Joined
Jan 14, 2017
Messages
18,216
It is grouped first by Project and then Discipline. Not every project has the same number of disciplines (Electrical, Mechanical, Painter, etc). Whichever discipline is last (at the bottom) the value for that discipline for PHours plus AHours shows up in the Subtotal text box, not the sum for all disciplines.

I don't understand how summing the disciplines in the Project group only sums the last named discipline in that group.
I suggest you check how this group has been summed as it shouldn't work that way.

I can't just add the Subtotals for AHours and PHours because I only want results where there was a value for both and this is not always the case.

That's exactly the reason why I posted this last time:
Code:
=Nz([Sum Of PHours],0)+Nz([Sum Of AHours],0)

It will give a total for those items with a cost avoiding null errors
If there are no costs for PHours or for AHours, the formula gives 0 for that group (or zero overall if no costs for either group)

Hopefully the above info will give you enough to complete this task yourself.
If not, suggest you post a sample database with example data to allow someone to help you further
 

Users who are viewing this thread

Top Bottom