SAP Knowledge Base Article - Public

1290317 - Calculate the % in crosstab

Symptom

How to show the % in a separate column in crosstab using the values from previous columns like (columnA-columnB)/columnA

Resolution

1.Right click on the first column A and go to format field and in conditional suppress write the condition as

WhilePrintingRecords;
NumberVar I := CurrentFieldValue;
False;

2.Right click on the second column B and go to format field and in conditional suppress write the condition as

WhilePrintingRecords;
NumberVar J := CurrentFieldValue;
False;

3.Now right click on the crosstab and go to crosstab expert and insert any database field in "field to summarise"

4.Right click on the third column C and go to format field in the common tab click on X+2 corresponding to the "Display String" and write the formula like this

WhilePrintingRecords;
NumberVar I;
NumberVar J;
If(I>0) Then ToText(((I-J)/I) * 100 ) + "%" else "0"

Keywords

KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports XI R2