Skip to content

Switch

Logic & variables

Switch(expr, v1, r1, v2, r2, … [, default])

Value-match conditional (SQL CASE expr WHEN v1 THEN r1 …). Match values must share the scrutinee’s type; results share one type; omitted default ⇒ blank. SQL equality applies: a blank scrutinee matches no branch and falls to the default — test blanks explicitly with Coalesce.

  • Mapping specific values of a measure to labels — 0 orders ⇒ “None”, 1 ⇒ “Single”. For ranges or thresholds, use Case.
OrderVolumeBand := Switch([Orders], 0, "None", 1, "Single", "Multi")