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 Percent Decimals... Again 2

Status
Not open for further replies.

RepRider

Technical User
Jan 25, 2007
114
US
[tt]MonoSpaced Text
CRXI and SQL

I have read various threads on this but my brain can never figure out what to do with my crosstab to make this work.

My report is an insurance profile that runs each month and shows the type of insurances, the number of clients with that insurance and the percent of the total. Because some are so few they show up as 0% which is of course incorrect. So I need the decimals to show up.

The crosstab looks as follows:
[tt]MonoSpaced Text[/tt]
Count Percentage
Total[tab] 986[tab]100%
MEDICAID[tab] 431[tab]43%
MEDICARE & MEDICAID 187[tab]18%
NONE[tab] 153[tab]15%
MEDICARE[tab] 37[tab]3%
See ShareCare[tab] 36[tab]3%
ADULT BENEFIT WAIVER[tab] 24[tab]2%
MI FAMILIES[tab] 21[tab]2%
MEDICAID, HAB[tab] 19[tab]1%
COMMERCIAL[tab] 18[tab]1%
MEDICAID AND COMMERCIAL 15[tab]1%
SPEND DOWN & MEDICARE 14[tab]1%
MEDICARE & SUPPLEMENT[tab] 9[tab]0%
SPEND DOWN 8[tab]0%
MI CHILD[tab] 5[tab]0%
MI FAMILIES OR COURT FUND 4[tab]0%
CHILD WAIVER & COMMERCIAL 3[tab]0%
CHILD WAIVER 1[tab]0%
MEDICAID, HAB, COMMERCIAL 1[tab]0%

Can someone take me SLOWLY STEP BY STEP on how to make these percentages to have at least one decimal?

Thanks in advance...

[/tt]
 
Right-click on the 'Percentage' field in the crosstab. Choose 'Format Field', the number and 'customise'. You can set the decimal places shown.

Or you could just select the field at use the .00 icon, if you have it.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Since you have the totals at the top, you can use the following method, which uses field formatting formula areas as containers only for running totals.

Select the total count->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar tot := currentfieldvalue;
numbervar curr := currentfieldvalue;
false

Then select the inner row cells for the count summary->right click->format field->suppress->x+2 and enter:
whileprintingrecords;
numbervar curr := currentfieldvalue;
false

Then select all cells (total and row) for the percentage column->right click->format field->DISPLAY STRING->x+2 and enter:

whileprintingrecords;
numbervar curr;
numbervar tot;
if tot > 0 then
totext(curr%tot,1)+"%" //1 for one decimal

-LB
 
This works great lbass!! Many thanks. Would the formulas be different if the totals were at the bottom? Now I have to figure out what this is doing so I will understand it. :)
 
Yes, you would have to do this differently if the totals were at the bottom, since the variable values are carried to cells/summaries below.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top