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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum of formula doesn't work 1

Status
Not open for further replies.

ekta22

IS-IT--Management
May 3, 2004
359
US
I have 5 different forumula's in the detail section of my report and then I summarize each one of them and display the summary of each in my group header. Summary is basically the count of records it finds for each formula.

Now, I have to add another formula(lets say formula 6) in my group header that will be the sum of 3 of the summarized formulas in my group header. So, for example this is how my group header looks like

Formula1-- Formula2 --Formula3 --Formula4 --Formula5
10---------------5-------------5------------20-----------6


Formula 6 should be the sum of formula 1 + formula 3 + formula 5, which will be 21. Right now this is what I have for formula 6

{@Formula1} + {@Formula3} + {@Formula5}

But it is not giving me the right result. It shows 4 instead of 21. I was wondering if this is due to the order of evaluation. Would appreciate any help.

Thanks
 
What is the content of each of the formulas? You should always provide formula contents when posting, since they can be relevant to the solution.

-LB
 
Formula's look something like this -

Formula 1
Code:
If ({pPMPERDET.COMPLETION_STATUS} = "O" AND {pPMPERDET.MAC= "U"}) then
{pPMPERDET.NO_TASKS}

Formula 2
Code:
If ({pPMPERDET.COMPLETION_STATUS}) = "X" AND ({pPMPERDET.END_DATE_TIME} < {pPMPERDET.LATEST_DATE}) AND ({pPMPERDET.MAC}) = "P" then
    {pPMPERDET.NO_TASKS}

Formula 3
Code:
If ({pPMPERDET.COMPLETION_STATUS} = "X" AND {pPMPERDET.MAC= "P"}) then
{pPMPERDET.NO_TASKS}

I then right click on each formula and insert a summary at the group level. My new formula needs to display the sum of records found under each formula in the same group.
 
Then your formula should be:

sum({@formula1},{table.groupfield}) + sum({@formula2},{table.groupfield}) + sum({@formula3},{table.groupfield})

The way you are doing it right now will only pick up the values of the formulas for the first record in the group.

-LB
 
I get an error - It says "There must be a group that matches this field" and it highlights the first part of formula.

sum({@formula1},{pPMPERDET.WR_CREW_UNIT}) + sum({@formula2},{pPMPERDET;1.WR_CREW_UNIT}) + sum({@formula2},{pPMPERDET;1.WR_CREW_UNIT})

My grouping is on wr_crew_unit.
 
Not sure why you would get the message except that in your post the first clause is missing the ";1". Should be:

sum({@formula1},{pPMPERDET;1.WR_CREW_UNIT}) + sum({@formula2},{pPMPERDET;1.WR_CREW_UNIT}) + sum({@formula2},{pPMPERDET;1.WR_CREW_UNIT})

-LB

 
That was a typo when I posted it here. It is correct in my code.
 
There is no reason that I can see that this wouldn't work--unless you don't in fact have a group on {pPMPERDET;1.WR_CREW_UNIT}.

-LB
 
Sorry, my bad. The grouping was on a formula based on this field. It works just fine. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top