Variance Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eliasam
    New Member
    • Dec 2007
    • 4

    Variance Query

    Hi can anyone help me with this?

    I've got a field in a query to calculate the weight charge:

    CalcWeightCharg e: [weight]*[RatePerKg]

    Then in another field i would like to calculate the variance from the given charge to the calculated weight charge, so i have used:

    WeighChargeVar: [WeightCharge]-[CalcWeightCharg e]

    When i run the query i get some variance even though there isn’t any. I get some of the following variances:

    5.6843418860808 E-14
    1.1368683772161 6E-13
    2.8421709430404 E-14

    Can someone please explain why i am getting these when there is no variance?

    The variance appears on some only not all..

    Thanks
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    These are extremely small values
    eg 5.6843418860808 E-14
    is 0.0000000000000 056843418860808

    This suggests to me that the variance is due to rounding differenses

    Comment

    • eliasam
      New Member
      • Dec 2007
      • 4

      #3
      Thanks,

      Is there a way were i can have it display 0 rather than these small values?



      Originally posted by Delerna
      These are extremely small values
      eg 5.6843418860808 E-14
      is 0.0000000000000 056843418860808

      This suggests to me that the variance is due to rounding differenses

      Comment

      • Delerna
        Recognized Expert Top Contributor
        • Jan 2008
        • 1134

        #4
        if the variance is only ever going to be whole numbers then you could use

        int(value) to drop the decimals altogether
        cint(value) rounds value to the nearest integer


        otherwise
        round(value,num decimals)

        check the help files as i'm going off memory here
        and my memory is notoriously bad

        Comment

        Working...