When using a calculation with a CASE statement that selects a measure depending on a parameter, the query that Tableau Desktop generates is not modified by the parameter value that is selected. Instead, all of the measures in the CASE statement appear in the query. This results in slower performance.
An example of the calculation, where [Measure Selector] is a parameter:
CASE [Measure Selector] WHEN 'Sales' THEN SUM([Sales]) WHEN 'Profit' THEN SUM([Profit]) WHEN 'Inventory' THEN ROUND(AVG([Inventory])*100,2) WHEN 'Margin' THEN ROUND(AVG([Margin])*100,2) END