We develop a quantitative framework for exactly decomposing trade patterns into economically meaningful components. We derive price indexes that determine comparative advantage across countries and sectors and the aggregate cost of living. If firms and products are imperfect substitutes, we show that these price indexes depend on variety, average appeal (including quality), and the dispersion of appeal-adjusted prices. We show that they are only weakly related to standard empirical measures of average prices. Of the cross-section (time-series) variation in comparative advantage, 50 (90) percent is accounted for by variety and average appeal, with less than 10 percent attributed to average prices.