## How does the SWITCH function (DAX) work?

The SWITCH function (DAX) evaluates an expression against a list of values and returns one of multiple possible result expressions.

## SWITCH Formula Syntax

SWITCH(
<expression>, <value>, <result>[, <value>, <result>]…[, <else>]
)

## How do you use the SWITCH function?

Use the SWITCH function to match a value of expression against several possibilities and return a result corresponding to the first matching value.

## Related Support Forum Posts

Slicer for switching analysis dimensions
Using A measure from a slicer as rule boundaries in a switch statement
Combine Calculate and Switch for multiple criteria or condition

## Considerations when using the SWITCHfunction

The first argument is called “expression” and can be a hardcoded constant, a cell reference, or another formula that returns a specific value you want to match against. Matching values and results are entered in value/result pairs. SWITCH can handle up to 126 matches. A optional final argument specifies a default result to return in cases where there is no match.

## Formula examples using the SWITCH function

=SWITCH([Month], 1, “January”, 2, “February”, 3, “March”, 4, “April” , 5, “May”, 6, “June”, 7, “July”, 8, “August” , 9, “September”, 10, “October”, 11, “November”, 12, “December” , “Unknown month number” )

=SWITCH(C5,1,”Poor”,2,”OK”,3,”Good”,”??”)

=SWITCH(WEEKDAY(A2),1,”Sunday”,2,”Monday”,3,”Tuesday”,”No match”)