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

percentage calculation

Status
Not open for further replies.

azamatali

Programmer
Aug 20, 2001
50
0
0
IN
i am working on .net crystal reports.
i have a field tax which gives me the tax %age and
i have amount field.
i want to calculate this tax percentage on sum of amounts say tax% is 5
and amts are 100,800,100
so result shiuld be 5/100*1000
how should i write it.
further i want to add this tax to total amount..
these 100,800,100 are also database field..
if i apply formula

{Table.Field1}*sum({table.field2})/100
then it is giving error for sum formula
that it should be evaluated later


 
You need to put the calculation after the sum has been calculated by placing it in a report section lower than the sum, and you will need to use the whileprintingrecords feature because the sum is not ready until the printing pass.
 
If {table.field1} and {table.field2} are both database fields, you should be able to create the formula as you did originally, and you should be able to display the result anywhere on the report, assuming you have no groups and that the tax percentage (field1?) is a constant for all records. If you have a group and you want to display the tax subtotal for the group, you would amend your formula to:

{Table.Field1}*sum({table.field2},{table.groupfield})/100

...and then place it in the group header or footer.

The error message leads me to think you might not be creating this formula in the right formula area. Do not try to create this in the selection formula area--instead go to the field explorer or to insert->formula field->new and enter the formula there.

You should then be able to add this formula to the sum for the group (or to the grand total). Or, you could do that within the same formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top