Complete the code to create a parameter that allows users to select a measure.
CREATE PARAMETER MeasureSelector AS STRING DEFAULT '[1]' ALLOWABLE VALUES ('Sales', 'Profit', 'Quantity')
The default value for the parameter should be 'Sales' to start with the common measure.
Complete the calculated field to swap measures dynamically based on the parameter.
CASE [MeasureSelector] WHEN 'Sales' THEN SUM([[1]]) WHEN 'Profit' THEN SUM([Profit]) WHEN 'Quantity' THEN SUM([Quantity]) END
The first WHEN clause should sum the 'Sales' field when the parameter is 'Sales'.
Fix the error in the calculated field to correctly handle the dynamic measure swap.
IF [MeasureSelector] = 'Sales' THEN SUM([Sales]) ELSEIF [MeasureSelector] = [1] THEN SUM([Profit]) ELSE SUM([Quantity]) END
The ELSEIF condition must check if the parameter equals 'Profit' to sum the Profit field.
Fill both blanks to complete the calculated field that returns the selected measure's sum or zero if none matches.
IF [MeasureSelector] = [1] THEN SUM([Sales]) ELSEIF [MeasureSelector] = [2] THEN SUM([Profit]) ELSE 0 END
The first condition checks for 'Sales', the second for 'Profit'. If neither matches, it returns 0.
Fill all three blanks to create a dynamic measure swap that covers Sales, Profit, and Quantity with a default zero.
CASE [MeasureSelector] WHEN [1] THEN SUM([Sales]) WHEN [2] THEN SUM([Profit]) WHEN [3] THEN SUM([Quantity]) ELSE 0 END
Each WHEN clause matches the parameter string to the corresponding field to sum. ELSE returns 0 if no match.