I am trying to add to an SQL statement the ability to output a number if another number is found in a column. Basically, map a number to a given value so we can calculate commissions inside of Excel. We have a value called PaymentMethodID that declares what kind of payment it was. Cash (1), check (2), credit card (3) or PayPal (4). Sales reps commissions change based on what kind of payment was used, so now we hand edit the spreadsheets to make the reports.
I would like to create a column called “Commission %” that outputs a decimal based on what is found in PaymentMethodID.
Example
SalesRep OrderValue PaymentMethodID Commission % Sara 100.00 1 15% Sara 80.00 2 15% Sara 350.00 1 15% Sara 200.00 3 12.5%
How can I create the “Commissions %” column and have the PaymentMethodID’s mapped to a percentage?
Use a CASE statement. Something like this: