Symptom
- How to calculate the difference between 2 columns?
- How to show the difference between two column values in a cross-tab in Crystal Reports?
Environment
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
Resolution
- To calculate the difference between columns on a cross-tab, use the Calculated Member functionality:
- On the cross-tab, right click on the column header showing the field value, and select: Calculated Member - Insert Column
- A column with a blank header and zero values will be added to the cross-tab.
- Right-click on the blank column header and select: Calculated Member - Edit Header Formula
- Then type "Difference" in the editor.
- Now, the blank column header displays the text 'Difference'.
- Right-click on one of the zero values in this column, and select: Calculated Member - Edit Calculation Formula
- Type a formula to calculate the difference in editor, like:
Gridvalueat(currentrowindex,currentcolumnindex-1,currentsummaryindex) - Gridvalueat(currentrowindex,currentcolumnindex-2,currentsummaryindex)
- The cross-tab now display the difference between the two columns.
- For more information on the functions used in the formula to calculate values in a cross-tab, see the Crystal Reports help.
Keywords
CR, Difference between two fields, difference, cross tab, difference between two fields in cross tab, crystal reports , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To
Product
SAP Crystal Reports 2016 ; SAP Crystal Reports 2020