Search code examples
crystal-reportsreportsummary

Ratio summary fields at detail level - Crystal Reports


I'm trying to find a way to show a ratio of a field of interest Vs the sum of the field of intrest and display this at the line details level.

Name: Profit: ProfitRatio:


ABC $1000 10%

XYZ $5000 50%

NMO $2000 20%

QST $2000 20%


TOTAL $10000

ie ProfitRatio for ABC = Profit / SumProfit = $1000 / $10000 = 10%

Because the totals are calculated after the detail levels I can't understand how to "reuse" the summary in a calculation at the line detail level. I'm guessing its something to do with printing order but I just can't get my head around it.

Any help would be appreciated Thank B

PS crystal version 8.5 & old foxPro .dbf


Solution

  • This can be possible through the following formula.

    numbervar a;
    a:=({Profit}/Sum ({Profit}))*100;
    a;
    

    Place this formula in Details and you will get the ProfitRatio.

    Note: Make sure that the fields Profit and SumProfit are in Numeric Data Type, if they are in string then you have to convert to numeric.

    Try this and get back with results. Ready to help you further !