Calculating Discount Percentage
I sell widgets, I have a table of orders which includes the number of widgets for that order.
I would like to generate a discount percentage for each order based on the rule :
1 – If the order is for 10 or less widgets the discount is 10%
2 – For every 5 additional wigets I want the discount to go up by a percent.
So an order of 10 widgets gets a 10% discount, an order of 15 widgets gets an 11% discount, an order of 20 widgets gets
a discount of 12% etc…
Well suppose your excel table looks like this :
You could run the following SQL to provide the required discounts :
WHEN (WIDGET_AMT<10) THEN 0
WHEN (WIDGET_AMT>=10) THEN (floor((WIDGET_AMT / 5) – 2) + 10)
END AS DISCOUNT
This SQL run in QueryCell will provide the table :