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

profit margin in cross-table crystal

Status
Not open for further replies.

calkowska

Technical User
Apr 25, 2011
3
US
Hi,
I am using Crystal Reports XI. I am trying to add a column that calculate the margin in a cross-tabs.
I tried to follow one of tec-tips but it does not work for me.
I've selected suppress, and then x+2 for inner cell and the rows total:
whileprintingrecords;
numbervar Sales:= {SO_SalesHistory.DollarsSold};false
and
whileprintingrecords;
numbervar COGS:= {SO_SalesHistory.CostOfGoodsSold};
false

Then I've created a formula {@0} and added it as my last summary field in the crosstab. Then I formated field under Display String; x+2 as below.
whileprintingrecords;
numbervar Sales;
numbervar COGS;
if Sales <> 0.00 then totext((Sales-COGS)%Sales,2)+"%"//2 for 2 decimals else 0.00

Please help me to improve the formulas.
 
You haven't implemented this correctly. Please identify your row fields, column fields, and summaries as shown in the crosstab expert.

-LB
 
Rows: AR_Customer.CountryCode
Columns: @fiscal year
Summarized fields:
Sum of SO_SalesHistory.DollarSold
Sum of SO_SalesHistory.CostOfGoodsSold

Thank you very much for your help.
 
Okay, you should just replace your fields with currentfieldvalue in the first two formulas, as in:

whileprintingrecords;
numbervar Sales:= currentfieldvalue;
false

whileprintingrecords;
numbervar COGS:= currentfieldvalue;
false

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top