mattdunn Posted July 23, 2009 Posted July 23, 2009 (edited) Hi, I have been struggling with this. I have a database of items for sale. Each item can have a constant discount, so "Widget A" always gets a discount of 10%, this of course is easy to calculate: Price * Discount (.1) But what if I wanted "Widget B" to have a 10% discount from 0-100 units, 15% from 101-500 units, 20% from 500+ units? Discount becomes a dynamic variable based on Quantity. Does anyone have any tips for this kind of calculation? Edited July 23, 2009 by Guest
mweiss Posted July 23, 2009 Posted July 23, 2009 How about this? A calculated field DiscountRate, defined by: Case(Quantity < 101; 0.10 ; Quantity < 501 ; 0.15 ; 0.20) Then a second calculated field, Discount, defined by: Discount = DiscountRate * Price
mattdunn Posted July 23, 2009 Author Posted July 23, 2009 Cool, it's always more simple than I think. If I could ask for one more bit of advice. What if those quantities (100 and 500) and those discounts (10, 15, 20) differ from product to product? "Widget C" could have a 30% discount only take effect at 10000+ units. I was thinking that the discounts and associated quantities could live in a different related table, that way each item could have any number of discounts. Any way to make that Case statement more portable/reusable?
comment Posted July 23, 2009 Posted July 23, 2009 Not calculation - lookup from a table of Discounts. See: http://fmforums.com/forum/showtopic.php?tid/197517/
mattdunn Posted July 23, 2009 Author Posted July 23, 2009 I will take a look at that. Thanks for the feedback.
Recommended Posts
This topic is 5672 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now