Profit is a percent of the cost price, discount a percent of the marked price. Take CP = 100, get SP from the profit, then MP from the discount.
Adding the two percentages (20% + 12% = 32%)
MP ÷ CP = (100 + profit%) ÷ (100 − discount%).