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

Allocate and exact amount based two formula's

Status
Not open for further replies.

episudics

Technical User
Dec 2, 2001
12
US
Allocation is based on Percent * Amount To Allocate
Percent is the total pay amounts grouped by project divided by employees total pay amount.

In our example the amount to allocate which is different for every employee is 22.00

Proj1 20.00 .33% * 22.00 =$7.26
Proj2 20.00
Proj3 20.00
Total 60.00

So for each project above I would get $7.26 for each project which totals 21.78. Unfortunately the amounts we allocate have to sum exactly to the figure we are using to allocate which in this example is $22.00. I tried using the formula below but it doesn't seem to work and I've tried various rounding combinations:

The {@Sumoffringe2} is the Total pay amount the ({#RTotal1} is the total pay amount at the proj level. I not certain the formula below can deliver what I want. Based on the above example the results I want would be as follows:

Proj1 20.00 .33% * 22.00 =$7.26
Proj2 20.00 .33% * 22.00 =$7.26
Proj3 20.00 .33% * 22.00 =$7.48
Total 60.00


If round({@Sumoffringe2},2) <= round({#RTotal1},2) then
round(({TT.Allocate}*{@Percent}),2)
else ({TT.Allocate}-(round(({TT.Allocate}*{@Percent}),2)))


 
Please share your exact formulas for {@sumoffringe2} and {@percent} and if you have any nested formulas, show those too. Please also explain why are you using running totals for the project totals instead of inserted summaries.

-LB

 
I don't see reason why running totals were needed I believe it's a holdover from an old report design.

Percent
whileprintingrecords;
numbervar Ted:={#RTotal0}/(sum({@SUMAMOUNT}))

Sumoffringe2
If {@Evaluate TaxableFringe} <= {#RTotal1} then
round(({Type3tax.TXLBFRNG}*{@Percent}),5)
else (round(({Type3tax.TXLBFRNG}*{@Percent}),5)-{Type3tax.TXLBFRNG})
 
I can't really follow which formula is which so I will just suggest the logic you could use. Assuming your report is grouped by Employee and then Project, you could create a running total {#Proj} which is a distinctcount of {table.project}, evaluate for each record, reset on change of group (employee). Place this in the Project group header and then create a formula:

if {#Proj} = distinctcount({table.project},{table.employee}) then
<running total of pay per project where reset is on change of project>+
(sum({table.pay},{table.employee}) -
<runningtotal of pay per project where reset is on change of the employee group>) else
<running total of pay per project where reset is on change of project>

This would have to be placed in the project group footer.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top