Show zero and not error when division by zero

S

SylvieB

Hello group,
How can I show the number zero when I do a divison by zero? On my report, it
shows #Error.
I created a report that calculates the difference in percentage for the
following:
(ProposalAmount – AwardAmount)/AwardAmount)
The code on the query is
%diff:([ProposalAward]-[AwardAmount])/[AwardAmount]
which works great except if AwardAmount = 0.
Any idea, how to put a zero instead of error?
Thank you all in advance for your help
 
K

KARL DEWEY

Try this --
%diff:iif([AwardAmount] Is Null, 0,
([ProposalAward]-[AwardAmount])/[AwardAmount])
 
K

kc-mass

Try This:

%diff:: IIF(AwardAmount = 0,
0,([ProposalAward]-[AwardAmount])/[AwardAmount] ))

Regards
Kevin
 
K

KARL DEWEY

Should be like this --
%diff:iif([AwardAmount] Is Null OR [AwardAmount] = 0, 0,
([ProposalAward]-[AwardAmount])/[AwardAmount])
--
Build a little, test a little.


KARL DEWEY said:
Try this --
%diff:iif([AwardAmount] Is Null, 0,
([ProposalAward]-[AwardAmount])/[AwardAmount])

--
Build a little, test a little.


SylvieB said:
Hello group,
How can I show the number zero when I do a divison by zero? On my report, it
shows #Error.
I created a report that calculates the difference in percentage for the
following:
(ProposalAmount – AwardAmount)/AwardAmount)
The code on the query is
%diff:([ProposalAward]-[AwardAmount])/[AwardAmount]
which works great except if AwardAmount = 0.
Any idea, how to put a zero instead of error?
Thank you all in advance for your help
 
H

Hans Up

KARL said:
Should be like this --
%diff:iif([AwardAmount] Is Null OR [AwardAmount] = 0, 0,
([ProposalAward]-[AwardAmount])/[AwardAmount])

%diff:iif(Nz([AwardAmount]) = 0, 0,
([ProposalAward]-[AwardAmount])/[AwardAmount])
 
S

SylvieB

It works great. Thank you all for your help. It is very appreciated.

kc-mass said:
Try This:

%diff:: IIF(AwardAmount = 0,
0,([ProposalAward]-[AwardAmount])/[AwardAmount] ))

Regards
Kevin


SylvieB said:
Hello group,
How can I show the number zero when I do a divison by zero? On my report,
it
shows #Error.
I created a report that calculates the difference in percentage for the
following:
(ProposalAmount - AwardAmount)/AwardAmount)
The code on the query is
%diff:([ProposalAward]-[AwardAmount])/[AwardAmount]
which works great except if AwardAmount = 0.
Any idea, how to put a zero instead of error?
Thank you all in advance for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top