negative value in report

  • Hi gurus,

    I have two fields charge aand payments and ineed to calculate total

    sum(charge- payments),but some times cgharge hase negative value,come time payments.

    How to calculate correct total?

    I try to =SUM(IIF(Cint(Fields!charge.Value) < 0, 0,Cint(Fields!charge.Value))-

    IIF(Cint(Fields!payments.Value) < 0, 0,Cint(Fields!payments.Value)))

    but it not correct.

    Thanks

  • Can you give some values of the numbers you are using and the result you are getting? Also give the result you want?

  • sure

    I have charge =-52.50

    and payment =100 ishould get balance =47.5,but now I am getting -152.5

    or I have charge =100 and payment = -200 I should get balance = -100,not 300

    Thanks

  • natalie_orlovsky (10/1/2010)


    sure

    I have charge =-52.50

    and payment =100 ishould get balance =47.5,but now I am getting -152.5

    or I have charge =100 and payment = -200 I should get balance = -100,not 300

    Thanks

    How do you have a charge of -52.50? If I am a customer I think this means I have a credit on your books of 52.50, then if I make a 100 payment I should have a credit of 152.50 which is a balance of -152.50

    How do you have a payment of -200? If I am the customer I think this means you sent me 200.

    What happens if you have a charge of 47.50 and a payment of 2.50? Should your result be 50.00 or 45.00? What about the opposite of a charge of -47.50 and a payment of -2.50? Should your result be -50.00 or -45.00?

    Basically it looks like you always want your negative number to be subtracted whether it is a charge or a payment. But from what I can tell it is also possible to have 2 negative or 2 positive numbers, then what do you do?

  • you know what ,that exact my problem.I think that it shouldn't be in that way,but it what i have now in the db and i can not changed,just have to deal with that

  • natalie_orlovsky (10/1/2010)


    sure

    I have charge =-52.50

    and payment =100 ishould get balance =47.5,but now I am getting -152.5

    or I have charge =100 and payment = -200 I should get balance = -100,not 300

    Thanks

    In your examples if you add the numbers together you will get the right amount

    (-52.50) + 100.00 = 47.50

    100.00 + (-200.00) = -100

    I am not sure what you want to do if both numbers are positive, or both are negative.

  • problem is that i have sometimes both numbers are positive like 150 and 100

    and in that case i should have 150-100 =50 not 150 + 100 =250

  • =IIF(Charge < 0, IIF(Payment < 0,charge - payment,Payment + charge),IIF(Payment < 0,charge + payment,charge - payment))

  • thanks,i try

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply