Reputation: 3
I have a crystal report which requires to report on components (RUB_0) that are included on payslips, specifically basic salaries and pension contributions.
Certain employees could have more than one payslip (BUL_0) in a month and as such only the latest (max) payslip (BUL_0) per employee has to be reported since we are working with month to date figures.
My data looks as follows:
BUL_0 DAT_0 RUB_0 AMT_0
1700000018 2017-01-31 00:00:00.000 SALACT_MTD 20000.000000000000
1700000019 2017-01-31 00:00:00.000 SALACT_MTD 40000.000000000000
I have built the following formula which reports correctly for the latest (max) payslip in the detail section of the report.
IF ({HISTOPAYE.RUB_0} = "SALACT_MTD") AND {HISTOPAYE.TYP_0} = 6 AND {HISTOPAYE.BUL_0} = Maximum({HISTOPAYE.BUL_0}, {HISTOPAYE.EMP_0})
THEN {HISTOPAYE.AMT_0}
ELSE 0
Which displays on my report as per the following image which is correct (on detail level)
updated image below:
When I try to add a summary for one of these formula fields, the "SUM" option is not available, nor is the actual report field. When trying to sum the value manually, crystal returns "This field cannot be summarized" warning.
I have found that the reason for this warning is because my formula above, is creating a constant which cannot be summed. I have tried casting the fields to different data types and have tried setting multiple formula's to reset the value as per the below article, however - it did not resolve my particular issue.
Crystal Report Sum of a Group Summary
I need to include a summary to the group footer of the formula written. Any assistance will be appreciated.
Upvotes: 0
Views: 668
Reputation: 9101
Try this:
Create a formula Initialize
and place in report header
Shared Numbervar counter;
counter:=0;
Change your existing formula like below:
Shared Numbervar counter;
Local Numbervar display;
IF ({HISTOPAYE.RUB_0} = "SALACT_MTD") AND {HISTOPAYE.TYP_0} = 6 AND {HISTOPAYE.BUL_0} = Maximum({HISTOPAYE.BUL_0}, {HISTOPAYE.EMP_0})
THEN display:={HISTOPAYE.AMT_0}
ELSE 0;
counter:=counter+display;
display
Now create below formula in group footer
Shared Numbervar counter;
counter; //This will give the final output sum of all values
Upvotes: 1