How to calculating percentage correctly? - InfoPath Dev
in

InfoPath Dev

How to calculating percentage correctly?

Last post 04-09-2007 04:40 PM by Matt Faus. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-07-2007 01:44 PM

    • marina
    • Not Ranked
    • Joined on 04-07-2007
    • USA
    • Posts 3

    How to calculating percentage correctly?

    FORM FIELDS:
    InvoiceAmount: (Example-)$5.29

    Repeating table fields:
    Department (drop-down): (Example-marketing)
    Line charge (read-only) : (InvoiceAmount*percentage*0.01)
    Percentage (integer): (Example-50)

    SCENARIO:
    The invoice amount needs to be charged to the different departments. The accounting clerk enters the percentage, and the line charge is automatically calculated.

    But, if the invoice amount is 5.29 and needs to be divided to two departments by 50%, it calculates $2.65 for each which totals up to $5:30.

    ANY SOLUTION for this wrong calculation?
  • 04-08-2007 10:58 PM In reply to

    • Aruna
    • Not Ranked
    • Joined on 12-13-2006
    • India
    • Posts 17

    Re: How to calculating percentage correctly?

    Hi marina,

    1.Double click on 'Line Charge (read-only)' field.
    2.Click on 'Format' button under Data tab.
    3.Change the decimal places to '3' and click 'Ok'.
    4.Now enter
    InvoiceAmount:$5.29, select Department, enter Percentage:50 and check Line charge.
    5.It displays as '$2.645'.(Now the total upto $5.29)

    Hope this helps you!

  • 04-09-2007 01:38 PM In reply to

    • marina
    • Not Ranked
    • Joined on 04-07-2007
    • USA
    • Posts 3

    Re: How to calculating percentage correctly?

    Aruna, thank you for your reply. But, I am looking more for a solution such as:

    Sum(Line_charge)
    if the line_charge>InvoiceAmount
    add to LastRow(Line_charge) $0.01

    Thanks.
  • 04-09-2007 01:42 PM In reply to

    • marina
    • Not Ranked
    • Joined on 04-07-2007
    • USA
    • Posts 3

    Re: How to calculating percentage correctly?

    correction:

    if Sum(Line_charge)>InvoiceAmount
    add to LastRow(Line_charge) $0.01
  • 04-09-2007 04:40 PM In reply to

    Re: How to calculating percentage correctly?

    Hi Marina,

    I played around with this a little bit and it looks like all of the calculations are happening as they should. I couldn't reproduce any rounding errors. Could you reproduce the situation in a simple form and mail it to me?

    You could rethink your rounding assumptions, or try to cook up a crazy default value formula using the modulus of the sum of previous siblings to implementing rounding manually.

    Hope this helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.