# Crystal Reports math for subtotal totals

I am trying to calculate the percentage of two column totals in Crystal Reports.  The formula below is the formula I am trying to use:

If {Command.cost}= 0 then 0 else sum{Command.cost}/sum{@labor gross}*100

What am I doing wrong?

Thank for your help in advance.
Asked:
###### Who is Participating?

Commented:
Assuming that is the formula you are missing ( ) around the summation fields

``````If {Command.cost} = 0 then
0
else
sum({Command.cost}) / sum({@labor gross}) * 100
``````

when you say subtotals does that mean there are groups?
Are you trying to put them in the group header/footer?
If so change the formula to

``````If {Command.cost} = 0 then
0
else
sum({Command.cost}, {YOURGROUPFIELD}) / sum({@labor gross}, {YOURGROUPFIELD}) * 100
``````

mlmcc
0

Author Commented:
Thank you again mimcc.  You have really helped me a lot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Already a member? Login.

All Courses

From novice to tech pro — start learning today.