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

Crosstab Percentage with Decimals 1

Status
Not open for further replies.
Jun 26, 2002
77
US
I know several people have been asking the question about how to display decimals for percentages in a crosstab. I have reviewed the comments, but I am at a loss. Below is a row in crosstab showing my counts and percentages. As you can see the percentages does not add to 100%. I need to show the decimal. I am using CR XIR2.

0-10 11-17 18-30 31-40 41-50 51-60 61-70 71+ Total
Status FY
R 07/08 13 10 37 48 96 171 221 781 1377
0% 0% 2% 3% 6% 12% 16% 56% 100%
 
Create a formula {@total} like this:

count({table.field},{table.rowfield})

If you don't have a group in your main report, create one to match your row field. Then in the crosstab, select the count summary->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar cnt := currentfieldvalue;
false

Add {@total} as your second summary field (remove the percentage summary) and choose "maximum" as the summary, and then right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar tot := currentfieldvalue;
false

Then on the same screen, go to display string and enter:

whileprintingrecords;
numbervar cnt;
numbervar tot;
totext(curr%tot,2)+"%"

-LB
 
lbass -
EXCELLENT!

I did get an error on the last step of the display screen.
whileprintingrecords;
numbervar cnt;
numbervar tot;
totext(curr%tot,2)+"%"

I found changing the curr to cnt corrected it. Is this correct?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top