Calculating percentage

G

Guest

I am calculating a percentage from two queries that count data.
The first query calculates the total orders [Total].
The second query calculates the number of orders that failed to process
[Failed].

When my third query attempts to perform the percentage calculation:
FailedItems:[Failed]\[Total]

It returns wither 100% or 0%. As if it thinks that I am dealing with
integers or something. I can see examples where this works. Help! TIA.
Mike
 
A

Allen Browne

Backslash performs integer division.

Try:
FailedItems: [Failed] / [Total]

Of course, that will still error if Total is zero.
 
G

Guest

Thank you Allen! Perfect! (old C programming skills bleeding through...)

Allen Browne said:
Backslash performs integer division.

Try:
FailedItems: [Failed] / [Total]

Of course, that will still error if Total is zero.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Mike said:
I am calculating a percentage from two queries that count data.
The first query calculates the total orders [Total].
The second query calculates the number of orders that failed to process
[Failed].

When my third query attempts to perform the percentage calculation:
FailedItems:[Failed]\[Total]

It returns wither 100% or 0%. As if it thinks that I am dealing with
integers or something. I can see examples where this works. Help! TIA.
Mike
 

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