Mike_In_Ga
Registered User.
- Local time
- Today, 05:27
- Joined
- May 27, 2008
- Messages
- 32
I am writing a query to calculate commissions. The query is built except for the commission rate and commission calculation. The issue is that the commission rate is not stored anywhere in another table and the rule is dependent on more than one variable. The rule, in English, is as follows:
If the stockcode is not equal to "X" or "Y", then the commission rate is $.25 per quantity
If the Stockcode is equal to "X" or "Y", AND the Customer is "A", then the commission rate = $1 per quantity
If the Stockcode is equal to "X" or "Y", AND the Customer is NOT "A", then the commission rate = $.75 per quantity
I have the Stockcode, Quantity, and Customer fields pulled. I can calculate the commission amount once I get the rate. I am just having a hard time putting all the ifs, ands, or buts into the expression for the commission rate.
I would rather build an expression to figure out the rate rather than create a seperate table to house the stockcode, customer, and rate and simply pull it into the query. I know that sounds convoluted but in this instance it would be a far better solution.
Any advice? Thanks.
If the stockcode is not equal to "X" or "Y", then the commission rate is $.25 per quantity
If the Stockcode is equal to "X" or "Y", AND the Customer is "A", then the commission rate = $1 per quantity
If the Stockcode is equal to "X" or "Y", AND the Customer is NOT "A", then the commission rate = $.75 per quantity
I have the Stockcode, Quantity, and Customer fields pulled. I can calculate the commission amount once I get the rate. I am just having a hard time putting all the ifs, ands, or buts into the expression for the commission rate.
I would rather build an expression to figure out the rate rather than create a seperate table to house the stockcode, customer, and rate and simply pull it into the query. I know that sounds convoluted but in this instance it would be a far better solution.
Any advice? Thanks.