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

sum of percentage of fields and group

Status
Not open for further replies.

maas

Programmer
Sep 3, 2009
148
BH
Hello All,

I am having problems while calculating the total percentage of fields which are in the details sections and in the group header which the final result must show 100.

My report has:

Group Header #1: CCY ( I am using SQL Expression called Cash to get the Amount on the specified period)
Group Header #2:pARTY
Details ----
formula = {@MarketP}/{@rm}
{@MarketP}=Capital(field from the DB) * Backrate( field from the DB) / 100
{@rm}= Sum (Values)+ Content Price(field from the DB)

Now, my first question is how to get the percentage for each field while printing the formula
and get the total of percentages at the end of Group Footer #2
But, at the same time while printing the total in report footer (the result should be) = sum (percentages for group #2) + Cash percentage = 100

In my case I used the instructions which lbass told me and it worked
,but a new requirement was raised that to include the Cash while calculating and make the total =100.

In my case it exceeded 100, so what can I do?

Thanks and Regards
 
Use the cash as part of what calculation? What did you try?

Let me also repeat--Please show the actual formulas, NOT descriptions of them.

-LB
 
Hello lbass,

In the group Header 1#, I am using a SQL Query to get the cash:
(SELECT sum(amount)
FROM gl_entry a,chart_acc b, posnrpt c
WHERE a.chart_acc_id=b.chart_acc_id
AND b.coa_code in ('400-N40002', '400-N40005','400-N40003','400-N40006','400-N40007')
and c.posn_dt < bk_val_dt
and rptno= (
select max(rptno) from posnrpt))

in the details sections, I am having

({@Market Total (US$)})/(Sum ({@Market Total (US$)}))*100 for each deal
where {@Market Total (US$)}={posnrpt.FACE_VALUE*100
and
Sum ({@Market Total (US$)}), I meant the total which is in the report footer

Now, the total is giving correct values for each group, but at the end the sum of all of them is exceeding 100.

So, what should I do?
 
Please show the content of the formula that sums the percentages and also the formula you are using for displaying the result in the report footer. Note that if you are using a variable to collect the percentages, you must use a separate display formula in the report footer.

-LB

 
lbass,

Currently I did not put any formula, So what do you suggest to have the value of 100 at the grand total in the report footer.

Because the sum should not give over 100.

I have tried to add a formula which has:

the sum of the Cash expression + the total in the Sum ({@Market Total (US$)}),CParty group

But, I got different results which is more than 100
 
Instead of describing what you are doing, please show the actual formulas. How do you know the sum is > 100 if you didn't use a formula?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top