The Power Apps Switch function evaluates a single condition against multiple possible matches. If a match is found, a corresponding value is returned. If no match is found, a default value is returned.
It is similar to the If function, but it can be more efficient and easier to read for complex conditions.
Syntax:
Switch( Formula, Match1, Result1 [, Match2, Result2, … [, DefaultResult ] ] )
- Formula – Required. Formula to evaluate for matches. This formula is evaluated only once.
- Match(s) – Required. Values to compare with the result from Formula. If an exact match is found, the corresponding Result is returned.
- Result(s)Â – Required. The corresponding value to return when an exact match is found.
- DefaultResult – Optional. If an exact match isn’t found, this value is returned. If you don’t specify this argument, blank is returned.
Return value, the Switch function will evaluate the Formula and compare it to each Match value in turn. If a match is found, the corresponding Result value is returned. If no match is found, the DefaultResult value is returned.
Using Switch function
Example 1:
As shown, we have a gallery displaying employee details, including employee ID, name, and department.

Switch( ThisItem.Department.Value, "Finance", "F", "Data Engineering", "DE", "Supply Chain", "SC", "Data & Analytics", "DA", "N/A" )

Now, you can see that it evaluates the formula ThisItem.Department.Value, which returns the name of the currently selected department in the gallery and compares it to each possible value in turn.
If a match is found, it returns the corresponding result, which is the abbreviated name of the department for the matching value.

Example 2:
In this case, we have a dropdown control named drp_monthno that contains month numbers.

Let’s add one Text label control to display the month name for selected month number in the drop down.
 Now, set the Text property of Text label control to formula given below.
Switch ( Value(drp_monthno.SelectedText.Value), 1, "January", 2, "Feburary", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "Novemeber", 12, "December", "N/A" )
You can see, it returns the month name for selected month number in dropdown list.

Use cases of the Switch Function
- You can use Switch function when you have to evaluate a single condition against multiple possible matches.
- Use the Switch function when you want to make your code more efficient and readable.
Also Read..
ShowColumns function in Power Apps
Reset multiple control values and all the controls within a form
Calendar and Clock function in Power Apps
Submit multiple records to a data source
![]()
