Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a cross tab which is pulling sums of hours for each user.And the display Column grand total in percentage. The cross tab displays as

              |  User1  |  User2  | Etc . . .
TotalTime        41.68     44.55
TotalHours       52.17     84.93
% Total          79.89%    52.45%

I use formula field and drag that formula field to SUMMARIZED FIELD. my formula is

VB
({TotalTime}/{TotalHrs}) * 100


but still it shows me this error `Division by zero`

Thank in Advance.!
Posted
Updated 12-Aug-13 20:54pm
v2

1 solution

Change formula to :
VB
If {TotalHrs}=0 Then 
   0
Else
  ({TotalTime}/{TotalHrs}) * 100
 
Share this answer
 
v2
Comments
Uknownymous 13-Aug-13 2:52am    
Thank you for the reply. It does not show me the error but all the % TOTAL ROW is all ZERO ..
Raimis9 13-Aug-13 2:55am    
It's zero, because column TotalHrs has zero value. What is correct data column name TotalHrs or TotalHours ?
Uknownymous 13-Aug-13 3:08am    
yes totalhours is negative value. is crystal report crosstab is disregarding negative values?? try the values diplay above in calculator with that given formula and its correct but when i integrate it crystal report it didn't work.. its all display as zero. i want to get that value 79.89& and 52.45%
Raimis9 13-Aug-13 3:22am    
Please check column names. There is "TotalHours" in your example and "TotalHrs" in formula. May be you have another column (TotalHrs) with zero value.
Uknownymous 13-Aug-13 3:33am    
Yes I already did. "TotalHours" and "TotalHrs" are the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900