### Title

Multiple Discounts using new totals

### Post

I have a table to hold all discounts. I am trying to find a way to run a calculation that runs each discount and re-totals and runs the next until all discounts are complete. I know this could be accomplished via script but I would like to avoid breaking normalization on such an important number (the final price!!!).

Example:

total before discount $100.00

15% off $85.00

10% off $76.50

This puts the total discount @ 23.5% not the 25% you would get by summing the discounts and then dividing.

Thank you in advance,

Craig

I find recursive custom functions fun so I was hoping you would want that. It's also much cleaner looking and works with any number of discount amounts.

Open Manage | Custom functions, click New and paste the text below into the custom function window:

/* This function deducts a sequence of discount percentages listed in Dlist from the amount in Amt */

If ( IsEmpty ( Dlist ) ; Amt ;

SteppedDiscounts ( Amt - Amt * GetValue ( Dlist ; 1 ) ; RightValues ( DList ; ValueCount ( Dlist ) - 1 ) ) )

Name the function SteppedDiscounts or edit the last line to match a name you choose to use. Add Amt and Dlist as parameters, Amt should be listed before Dlist to match the order in the last line of the function.

To use this function, define a calculation field like this:

SteppedDiscounts ( UndiscountedTotal ; List ( RelatedDiscounts::RateField ) )

This field will now compute the discounted total of your invoice.