Crystal Reports Percentage formula

hi,

I have a cross tab table with the following data:
Debt Credit Payment
Dec 16 Jan 17 etc
Tot Debt Recd Tot Credit Given Tot Amt Paid
Dec 16 €10,000.00 €1,500.00 €1,000.00
Jan 17
ETC

I want to add another column that would calculate what percentage is the (Tot Amt paid) of the (Tot Debt recd minus Tot credit given)

I’ve tried creating a field formula and entering it in the cross tab but that didn’t work.

Any help much appreciated.
Thanks!

K


juguete (BOB member since 2017-01-26)

You’ll need to use advanced formulas in the crosstab. To do this:

  1. Right-click on the cross-tab and select “Advanced Calculations” and then “Embedded Summary”.

  2. Create a new summary and then click on “Edit Embedded Summary”.

  3. To remove the possibility of having a 0 in the denominator, which will cause an error, you’ll have to do something like this in the formula:


If  (GridValueAt(CurrentRowIndex, GetColumnPathIndexOf('Tot Debt Recd'), CurrentSummaryIndex) -
  GridValueAt(CurrentRowIndex, GetColumnPathIndexOf('Tot Credit Given'), CurrentSummaryIndex)) > 0 then
GridValueAt(CurrentRowIndex, GetColumnPathIndexOf('Tot Amt Paid'), CurrentSummaryIndex) %
 (GridValueAt(CurrentRowIndex, GetColumnPathIndexOf('Tot Debt Recd'), CurrentSummaryIndex) -
  GridValueAt(CurrentRowIndex, GetColumnPathIndexOf('Tot Credit Given'), CurrentSummaryIndex))
else 0

This uses the “Grid Value” functions that are only available in the formula editor when you’re working with a crosstab.

I don’t guarantee that you won’t have to tweak this, but it should get you started.

-Dell


hilfy :us: (BOB member since 2007-04-16)

hi,

thanks for this but I don’t seem to have the Advanced Calculations option when I right click on the cross tab. :confused:

perhaps we’ve two different versions.


juguete (BOB member since 2017-01-26)

Which version are you using?

-Dell


hilfy :us: (BOB member since 2007-04-16)

hi, sorry I thought I mentioned it before. I have version 10.


juguete (BOB member since 2017-01-26)

Then I don’t think there’s going to be much you can do for this. I believe the advanced calculations were added in 2008 (or possibly XI).

If you’re using version 10, are you doing this from within Visual Studio 2008 - this is the version of Crystal that came with that version of VS.

-Dell


hilfy :us: (BOB member since 2007-04-16)

oh I see. no I’m not sure Visual Studio. I might look into upgrading to newer version then.
thanks anyway!


juguete (BOB member since 2017-01-26)