Decimals

  • Thread starter Thread starter Leo
  • Start date Start date
L

Leo

One of my query has an expression and I expect answers with decimal points.
But anything less than one shows up as 1. What am I doing wrong?

Thanks
Leo
 
Can you share your expression or are you going to make us guess?
Can you share your data types?
Can you tell use where it "shows up as 1"?
 
There is a summery query named 'PERITONITIS STATS Query
It is based on another query named 'qryPD STATS'
The summary query has two fields:
First field is sum of all the TOTALDAYS from the qryPD STATS divided by
30: Sum Of TOTALDAYS: Sum([qryPD STATS].[TOTALDAYS]) Mod 30
Second field is sum of PERITONITIS PER MONTH from the qryPD STATS
Third field is the calculated field I need and the calculation is the
above second field divided by the first field. The expression I wrote for
that is as follows: Expr3: Sum([qryPD STATS].[PERIT PER PT MONTH]) Mod [Sum
OF TOTALDAYS]

Expected answer is 6 / 29 expressed in decimals.
But I get an answer now as 4!
(On my previous post the expression was written slightly different and
was giving me an answer 1. I have discarded that since. And my question at
that time really was is there is anything I need to do when designing a query
that will allow answers in fractions and decimal?)

Thank you Duane
Leo
 
There is a summery query named 'PERITONITIS STATS Query
It is based on another query named 'qryPD STATS'
The summary query has two fields:
First field is sum of all the TOTALDAYS from the qryPD STATS divided by
30: Sum Of TOTALDAYS: Sum([qryPD STATS].[TOTALDAYS]) Mod 30
Second field is sum of PERITONITIS PER MONTH from the qryPD STATS
Third field is the calculated field I need and the calculation is the
above second field divided by the first field. The expression I wrote for
that is as follows: Expr3: Sum([qryPD STATS].[PERIT PER PT MONTH]) Mod [Sum
OF TOTALDAYS]

Expected answer is 6 / 29 expressed in decimals.
But I get an answer now as 4!
(On my previous post the expression was written slightly different and
was giving me an answer 1. I have discarded that since. And my question at
that time really was is there is anything I need to do when designing a query
that will allow answers in fractions and decimal?)

Thank you Duane
Leo
 
Hi Leo,

Mod doesn't perform division, it returns the integer remainder after division.

So if [Sum OF TOTALDAYS] is 29 and Sum([qryPD STATS].[PERIT PER PT MONTH])
is 6 I would expect your calculated field to return 6 Mod 29, which is 6.

You need to cheng 'Mod' to '/', which should then return 0.206896551724138.

Cheers,
Alex.


Leo said:
There is a summery query named 'PERITONITIS STATS Query
It is based on another query named 'qryPD STATS'
The summary query has two fields:
First field is sum of all the TOTALDAYS from the qryPD STATS divided by
30: Sum Of TOTALDAYS: Sum([qryPD STATS].[TOTALDAYS]) Mod 30
Second field is sum of PERITONITIS PER MONTH from the qryPD STATS
Third field is the calculated field I need and the calculation is the
above second field divided by the first field. The expression I wrote for
that is as follows: Expr3: Sum([qryPD STATS].[PERIT PER PT MONTH]) Mod [Sum
OF TOTALDAYS]

Expected answer is 6 / 29 expressed in decimals.
But I get an answer now as 4!
(On my previous post the expression was written slightly different and
was giving me an answer 1. I have discarded that since. And my question at
that time really was is there is anything I need to do when designing a query
that will allow answers in fractions and decimal?)

Thank you Duane
Leo


Duane Hookom said:
Can you share your expression or are you going to make us guess?
Can you share your data types?
Can you tell use where it "shows up as 1"?
 
Back
Top