Hello All,
I have prepared crosstab report in Crystal Report 2013 as shown below and get year difference using calculate columns fields. But year difference not appeared when i change the input parameter and select other year. I need help to create calculated columns dynamically.
Report Criteria
Report Output
I used to below code in calculated columns to show year difference
Difference b/w 15 & 16
if GetColumnPathIndexOf({?Year}-3)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-3), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-2), CurrentSummaryIndex))
Difference b/w 15 & 17
if GetColumnPathIndexOf({?Year}-3)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-3), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-1), CurrentSummaryIndex))
Difference b/w 15 & 18
if GetColumnPathIndexOf({?Year}-3)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-3), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}), CurrentSummaryIndex))
Difference b/w 16 & 17
if GetColumnPathIndexOf({?Year}-2)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-2), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-1), CurrentSummaryIndex))
Difference b/w 16 & 18
if GetColumnPathIndexOf({?Year}-2)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-2), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}), CurrentSummaryIndex))
Difference b/w 17 & 18
if GetColumnPathIndexOf({?Year}-1)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-1), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}), CurrentSummaryIndex))
Many thanks for any hint, much appreciated.
Best Regards,
Hi Anwar,
Right-click the Calculated Column's header cell > Select Calculated Member > Edit Insertion Formula > Use this code:
GetColumnGroupIndexOf(CurrentColumnIndex) = 0
-Abhilash
Thank you Abhilash and so nice of you. It works fine. Many many thanks. :)