Skip to main content

Conditional Expression

// ternary condition operator
x==1 ? 10 : 20 // if x equals 1, this expression returns 10, otherwise 20.

// nested usage
x==1 ? 10 :
x == 2 ? 20 :
x == 3 ? 30 :
40

// syntax for a switch with branches doesn't exist yet
In Measures:
sum(q1 <= 5 ? null : q1) // sum of all values greater than 5
In Groups:
// nested ternary condition operator to define a group
segment==1 ? true : (segment==2 and q5==1) ? true : false