Help with reports (1 Viewer)

seamusnboo

Registered User.
Local time
Today, 10:33
Joined
Jul 28, 2004
Messages
20
I have this report that shows me the quantity of different products. I also have to show on the report the percentage of the quantity of each product. So I created a percentage field on the report that divides the quantity of certain product by the total number of products and it gives me the percentage of it. But there's a problem. When certain product has a quantity of zero, the percentage shows me #Error. I know it shows an error because you can't divide by zero, but isn't there a way that instead of showing this error on the report it would show just 0%? How can I do it?

Thanks.
 
seamusnboo said:
I have this report that shows me the quantity of different products. I also have to show on the report the percentage of the quantity of each product. So I created a percentage field on the report that divides the quantity of certain product by the total number of products and it gives me the percentage of it. But there's a problem. When certain product has a quantity of zero, the percentage shows me #Error. I know it shows an error because you can't divide by zero, but isn't there a way that instead of showing this error on the report it would show just 0%? How can I do it?

Thanks.

=IIF([divisor]=0,0,[numerator]/[divisor])


P.S. There is a Reports category that would have been a more appropriate place to post this
 
First I'd like to apologize for not posting on the apropriate category, I'll pay more attention next time.

Second well, your expression works, but in some of the products I have a problem. In some of them, when the query finds zero products of certain category, instead of outputing zero, the query is outputing nothing so it only shows a blank space on the report, instead of a zero. Then your expression doesn't work because there isn't a zero, just a blank field. How can we reconstruct the expression for it to change blanks into zeros?

Once again thanks a lot
 
Not sure how you are getting your counts. Probably the Nz function can be used to force a zero when a null is encountered or you can use:

=IIF(Nz([divisor],0)=0,0,[numerator]/[divisor])
 

Users who are viewing this thread

Back
Top Bottom