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!

Percentage calculation

Status
Not open for further replies.

idehen

Technical User
Oct 26, 2004
92
GB
Good Afternoon

I am using CR 2008.

I have a grand total amount that is calculated based on value from a sub report and value from a main report.

However i want to create a percentage of the total sum and not sure how to do this in crystal cos in excel you simply use the $field for fixed data or cell.

Crystal Data

Order Name Value
Damage sets 102.1
Returned Goods 205.2
Bargainers 900.4
Effs 300.4
Accounts 2000.52

Total 3508.62


Note that Accounts is from a sub report and adds to the over all sum.

However, what i want is a report that produces.

Order Name Value Percent
Damage sets 102.1 (102.1/3508.62)*100
Returned Goods 205.2 (205.2/3508.62)*100
Bargainers 900.4 (900.4/3508.62)*100
Effs 300.4 (300.4/3508.62)*100
Accounts 2000.52 (2000.1/3508.62)*100

Total 3508.62

How can i do this please.

Thanks
 
Can you insert a sum on {table.value} and get the correct subtotal before the account subreport amount is added in? If so, you can move the Accounts subreport to the report header, share the Accounts amount, and create a formula in the main report like this and then reference the tot variable in a formula for the percentage:

whileprintingrecords;
shared numbervar accts;
numbervar tot := sum({table.value}) + accts;
sum({table.value},{table.ordername}) % tot

-LB
 
Lb Thanks for this. Sorry i've been away on holiday and just returned to the hustle and bustle of work again.

The formula worked Ok.

Thanks very much again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top