I am using Crosstab to calculate my working days and jobs. The report displays the information fine however, right on top of the Crosstab it shows
0 - 2.34%
I am wondering what is this and why is it showing 0 and if it is showing 0 then 0 / 23007 should be 0% and not 2.34%.
Where is this percentage coming from I have no idea and why is that 0 coming up I have no clue either.
Here is the layout of the report
Days - Jobs - Percentage
0 2.34%
1 6958 23.94%
2 6231 26.45%
...
Total - 23007 - 100%
here is the code used:
WhileprintingRecords; Local DateVar Start := {order_header.date_entered}; // Starting Date Local DateVar End := {order_header.act_despatch}; // Ending Date Local NumberVar Weeks; // Number of weeks Local NumberVar Days; // Number of days Local Numbervar Hol:=0; //Number of holidays Shared DateVar Array Holidays; // Bank holidays dates array Weeks:=(Truncate(End - dayofweek(End) + 1 - (Start - dayofweek(Start) + 1))/7)*5; Days:=DayOfWeek(end) - Dayofweek(Start) + 1 + (if dayofweek(start) = 1 then -1 else 0) //adjust for starting on sunday: +(if dayofweek(end) = 7 then -1 else 0); //adjust for ending on a saturday: //Check for bank holidays Local NumberVar i; For i := 1 to Count (Holidays) do (if DayOfWeek (Holidays<i>) in 2 to 6 and Holidays<i> in Start to End then Hol:=Hol+1 ); Weeks + Days - Hol;
Can someone please help me to identify this problem, i suspect it is coming because I have put in
Days:=DayOfWeek(end) - Dayofweek(Start) + 1 + (if dayofweek(start) = 1 then -1 else 0) //adjust for starting on sunday: +(if dayofweek(end) = 7 then -1 else 0); //adjust for ending on a saturday:
however not sure.
Please help
many thanks
Kind Regards
Jehanzeb
Hi Jehanzeb,
I do not see any problems with working days calculation formula, but I do not know how jobs have been calculated or what is the percentage formula?
For example:
(6958 / 23007)*100 = 30.242% but you have 23.94%
Am I missing something?
Can you provide more details how you designed your crosstab?
Add a comment