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

Cross-tab 'show as percentage' sum<>100% 1

Status
Not open for further replies.

JeroenBoon

Technical User
Aug 15, 2002
106
NL
Hello,

I hav the following problem:
in a cross-tab I display number of shipments in three groups. In the fist column I display the distinct count of the shipping number (a shipment has multiple lines). In the second column I display the distinct count of the shipment numbers as a percentage of the total distinct count of the shipment numbers. But the displayed percentages have no decimals and are rounded wrong.

group 1, 2976 shipments, 71% but should be 72 or 71,8
group 2, 660 shipments, 15% but should be 16% or 15,9
group 3, 515 shipments, 12% but should be 12,4%
total, 4142 shipments, 100%

Is there any way to format the percentage column with 1 decimal or to round correctly? The normal formatting doesn't work for this column.

Thanks, Jeroen.
 
Which version of Crystal? You ought to be able to right-click and format to decimal places.

You can also use a formula field in Crystal 10, perhaps in earlier versions as well.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
i'm sorry: CR 10.
The right clicking and format does't work: when you select 1 decimal and press 'OK' the new format is not used in the column. And when you go back to the format box, again 0 decimals is selected.
I'v tried to 'format paint' from a column with the right format, but tah does't affect the number of decimals. The only format-change that I can achieve, is suppress or show the '%'. Bug?
 
Thanks Ido.
They apparently fixed the problem that the percentages always were displayed as 'number.00%', but instead of taking care that the right decimals are displayed they simpley truncate the percentages? Not a wonderful fix I think.
But anyway: I think I need the work arounds mentioned in your link, but for some reason I can't find the file 'cr_percent_of_distinct_count.pdf'.

Anyone?
 
If your CrossTab contains only per-shipment rather than per-line summary info, and if the CrossTab is not too wide as needing virtual horizontal pages, then there's a simpler fix.

Create a subreport that selects only order (shipment) records and DON'T join to line items. Create a formula with a constant expression of 1.

Sum (note: NOT count) that formula in a CrossTab within the subreport. That would give you the shipment count. Use a PercentOfSum in that CrossTab. PercentOfSum doesn't suffer from the truncation problem.

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks Ido! youre suggestion made me figure out an even simpeler solution: shipmentlines have linenumbers, so I created a counter that gives a 1 when linnumber = minimum linenumber of the shipment or else a 0. In the cross-tab I sum the counter and in the second column I show the summed counter as a % of the total counter sum. Ans as you told, the displayed % when using a sum is able to display the right decimals.
a star for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top