Hi
I am creating a report to show monthly Labour Turnover.
In my report I have two totals:
Headcount
Leavecount
In order to calculate the Headcount total and Leavecount total I have two formulas as follows
@Headcount
If Z = 1 then 0 else 1
@Leavecount
If Z=2 then 0 else 1
Where Z is just a field in my table which signifies whether a row relates to Leaver or Headcount
I then get Crystal to total the two formulas to give me a
LeaveCount and Headcount. I then put these totals in the Month group header so that the totals relate to each month
This works fine BUT
If I want to divide the Monthly Headcount figure with the Monthly Leavecount figure I run into trouble as Crystal won't allow me to create make one of my subtotals a percentage of the other subtotal.
I have tried to force the issue by creating a formula with the following code:
whileprintingrecords;
//variable to store Headcount
Numbervar HCount = 0;
//variable to store Leavecount
Numbervar LCount= 0;
//variable to store LabourTurnover
Numbervar LabourTurnvover=0;
select {Z}
case 1: HCount :=HCount+1
case 2: LCount :=LCount+1;
if HCount <> 0 then
LabourTurnover := LCount/HCount * 100
if HCount <> 0 then
But it doesn't work and returns 0.
I am really tearing my hair out over this one
![[3eyes] [3eyes] [3eyes]](/data/assets/smilies/3eyes.gif)
So any help is much appreciated!
Nassy
I am creating a report to show monthly Labour Turnover.
In my report I have two totals:
Headcount
Leavecount
In order to calculate the Headcount total and Leavecount total I have two formulas as follows
@Headcount
If Z = 1 then 0 else 1
@Leavecount
If Z=2 then 0 else 1
Where Z is just a field in my table which signifies whether a row relates to Leaver or Headcount
I then get Crystal to total the two formulas to give me a
LeaveCount and Headcount. I then put these totals in the Month group header so that the totals relate to each month
This works fine BUT
If I want to divide the Monthly Headcount figure with the Monthly Leavecount figure I run into trouble as Crystal won't allow me to create make one of my subtotals a percentage of the other subtotal.
I have tried to force the issue by creating a formula with the following code:
whileprintingrecords;
//variable to store Headcount
Numbervar HCount = 0;
//variable to store Leavecount
Numbervar LCount= 0;
//variable to store LabourTurnover
Numbervar LabourTurnvover=0;
select {Z}
case 1: HCount :=HCount+1
case 2: LCount :=LCount+1;
if HCount <> 0 then
LabourTurnover := LCount/HCount * 100
if HCount <> 0 then
But it doesn't work and returns 0.
I am really tearing my hair out over this one
![[3eyes] [3eyes] [3eyes]](/data/assets/smilies/3eyes.gif)
So any help is much appreciated!
Nassy