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

crosstab percentage 2

Status
Not open for further replies.

jambu

Programmer
Nov 20, 2002
185
GB
In CR v9 I have a detail level which has two formulas A and B that I want to show as B being a percentage of A in a crosstab.

I have several group levels for columns and a single group level for rows.

How do I show this percentage, do I need to create a formula? The summaries don't seem to allow this.
 
You can use this by creating running totals within the crosstab formatting formula areas. Let's say you have entered A and B as summary fields in the crosstab. Create a formula {@0}:

Whilereadingrecords;
0

Add this as a third summary, below the others. You will use this to display the percentage later. Then select A->format field->common tab->suppress->x+2 and enter:

whileprintingrecords;
numbervar A := currentfieldvalue;
false //so that the cell is not suppressed

Then select B->format field->common tab->suppress->x+2 and enter:
whileprintingrecords;
numbervar B := currentfieldvalue;
false

Then select {@0}->format field->common->DISPLAY STRING and enter:
whileprintingrecords;
numbervar A;
numbervar B;
totext(B % A);

If you want to format the totals this way also, you can select the relevant cells as a group before entering each of the above formulas.

This is based on a technique by Ken Hamady.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top