Skip to content

Case

Logic & variables

Case(cond1, r1, cond2, r2, … [, default])

Multi-branch searched conditional (SQL CASE WHEN … THEN …): conditions are evaluated in order and the first true one wins; the optional trailing default catches the rest (omitted ⇒ blank). All results must share one type. This replaces the DAX SWITCH(TRUE(), …) idiom directly.

  • Tiering and banding on measure values: revenue tiers, risk bands, RAG (red/amber/green) statuses.
  • Any first condition that matches logic — thresholds naturally read top-down.
RevenueTier := Case(
[Revenue] >= 1000000, "Tier 1",
[Revenue] >= 100000, "Tier 2",
"Tier 3")
  • Conditions compare measure-level values. Branching on a bare column (Case(Sales.Segment = "SMB", …) at the top level) is row logic — a calculated field (SQX014).