fbpx
Select Page

Returns the result corresponding to the first matching value.

Usage

Switch(<value>, <case 1>, <result 1>, <case 2>, <result 2>, …, <else>)

value (required) The value to test.

case 1 (required): The case to test the value against. If the <value> matches <case>, the following <result> is returned.

result 1 (required): The result to be returned if its preceding case matches the input value.

case 2+, result 2+ (optional): Several <case> <result> pairs can be listed in a single function. Every supplied case must have a corresponding result.

else (optional): The result to be returned if no cases match the value. If no <else> condition is supplied, a Null result is returned when no cases are met.

Examples

Switch(1, 0, “None”, 1, “One”, “Many”)
  • Returns “One”
Switch(2, 0, “None”, 1, “One”, “Many”)
  • Returns “Many”

See Also

if

More About Logical Functions

Logical functions test for True/False values. They evaluate a condition, and return a value based on whether the condition is True or False.

We are rewriting the rules of analytics. Sigma empowers domain experts to join the data conversation, answer the toughest questions, and drive insights.