Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Power Apps Switch Function (6 Practical Examples)

A status column says “In Progress,” but your users want a sentence that tells them what happens next. Or a gallery needs one color per priority, and your nested If keeps growing.

Switch fixes both: one value, a list of matches, and the result paired with the first match.

In this tutorial, I’ll show you how to use the power apps switch function with six tested examples, from status messages to a SharePoint filter.

Switch Function Syntax

Switch( Formula, Match1, Result1 [, Match2, Result2, ... [, DefaultResult ] ] )
ParameterRequiredTypeDescription
FormulaYesAny valueThe value to test, evaluated only once.
Match1, Match2...YesSame type as FormulaValues compared with Formula. Only an exact match counts.
Result1, Result2...YesAny (text, color, action…)What Switch returns or runs for that match.
DefaultResultNoAnyReturned when nothing matches; without it you get blank.

Return value: the Result paired with the first exact match, the DefaultResult when nothing matches, or blank. Matches are checked in order, and Switch stops at the first one.

Switch isn’t on Microsoft’s delegable list. On a column inside Filter, it only sees the first 500 rows (see my Power Apps delegation guide). On a control value, its answer is a constant, so the query still delegates. In OnSelect, each Result can be an action.

When to Use the Switch Function

  • Turn a choice value (New, In Progress, Closed) into a friendly message.
  • Color gallery rows, like these gallery conditional formatting examples.
  • Run a different action from one button, based on a dropdown pick.
  • Map short codes (HR, IT, FIN) to full names, with a fallback.

Example 1: Show a Message for the Selected Status

A modern dropdown control lists the Status choices from my Service Requests SharePoint list. A label under it explains each status.

Select the label in the tree view, pick Text in the property dropdown left of fx, and type in the formula bar. Test with Play or Alt+click.

Switch formula typed in the formula bar for the label Text property in Power Apps Studio
Switch(
    ddSwStatus.Selected.Value,
    "New", "Waiting for a technician",
    "In Progress", "A technician is working on it",
    "Closed", "Resolved - no action needed",
    "Pick a status"
)
Preview showing the Switch message for the In Progress status

How does this work?

Switch compares the selected value with each match in order. With In Progress picked, the label shows “A technician is working on it.” With nothing picked, no match fits, so the default “Pick a status” appears.

Example 2: Return a Default Result When Nothing Matches

Maria Torres on the help desk types a department code into a text input, and a label spells it out:

Switch(
    txtSwCode.Text,
    "HR", "Human Resources",
    "IT", "Information Technology",
    "FIN", "Finance",
    "Unknown department code"
)

A second label runs the same test without a default:

"No default: " & Coalesce(Switch(txtSwCode.Text, "HR", "Human Resources", "IT", "Information Technology"), "(blank)")
Preview comparing a Switch with a default result and one without a default

How does this work?

“IT” returns “Information Technology” in both labels. For “OPS”, the first label falls back to “Unknown department code”, and the second returns blank. Then I typed “it” in lowercase and got “Unknown department code” too.

Preview showing that Switch does not match a lowercase department code

Pro Tip: Text matching in Switch is case-sensitive. Wrap the input in Upper(), like Switch(Upper(txtSwCode.Text), ...), when users might type lowercase.

Example 3: Color Gallery Rows by Priority

Switch can return colors, too. A gallery shows the first eight Service Requests, and I set the row label’s Color property from the Priority column (Low, Normal, High):

Switch(
    ThisItem.Priority.Value,
    "High", Color.Red,
    "Normal", Color.DarkOrange,
    "Low", Color.Green,
    Color.Gray
)
Switch formula in the Color property of a gallery label in Power Apps
Gallery rows colored red, orange and green by priority with Switch

How does this work?

Switch matches each row’s priority: High turned red, Normal orange, Low green. Color.Gray covers blanks.

Example 4: Check Ranges With Switch(true, …)

Switch only does exact matches. For ranges, switch on true and write a condition as each match. My list’s due dates are all past, so this gallery uses four sample tickets:

Table(
    {Title: "Laptop replacement #1000", DueDate: Date(2026, 11, 13)},
    {Title: "Password reset #1005", DueDate: Date(2026, 11, 17)},
    {Title: "VPN access #1001", DueDate: Date(2026, 11, 20)},
    {Title: "Teams phone #1004", DueDate: Date(2026, 12, 4)}
)

The row label adds the due-date bucket:

Switch(
    true,
    ThisItem.DueDate < Today(), "Overdue",
    ThisItem.DueDate = Today(), "Due today",
    DateDiff(Today(), ThisItem.DueDate) <= 7, "Due this week",
    "Later"
)
Gallery showing Overdue, Due today, Due this week and Later labels from Switch true

How does this work?

Each condition returns true or false, and the first true one wins. On 11/17/2026, the rows showed Overdue, Due today, Due this week and Later. Overdue sits first because those dates would pass the DateDiff function check too.

Example 5: Run a Different Action From One Button

A dropdown lists Hardware, Software, Access and Network. The Route request button’s OnSelect sends a different notification for each:

Switch(
    ddSwCat.Selected.Value,
    "Hardware", Notify("Sent to Desktop Support", NotificationType.Success),
    "Network", Notify("Sent to the Network team", NotificationType.Success),
    Notify("Sent to the Service Desk queue", NotificationType.Information)
)
Switch formula in the OnSelect property of a Route request button
Green notification banner after routing a Hardware request with Switch

How does this work?

Hardware showed “Sent to Desktop Support.” Software has no branch, so the default Notify message “Sent to the Service Desk queue” appeared.

Example 6: Filter a SharePoint List With Switch

Service Requests has over 600 items. A dropdown offers friendly views (Waiting, Working, Done), and the gallery’s Items property turns them into Status values:

Filter(
    'Service Requests',
    Status.Value = Switch(
        ddSwView.Selected.Value,
        "Waiting", "New",
        "Working", "In Progress",
        "Done", "Closed"
    )
)
Gallery Items formula using Switch inside Filter without a delegation warning
Gallery showing Closed service requests after picking the Done view

How does this work?

Switch only reads the dropdown, so it returns a constant. Studio showed no delegation warning, and Done listed the Closed requests.

Tips & Common Mistakes

  • Record instead of text. Switch(ddSwStatus.Selected, "New", ...) shows “Invalid argument type (Text). Expecting a Record value instead.” Add .Value.
  • Switch on a column inside Filter. Filter('Service Requests', Switch(Priority.Value, "High", true, false)) got a delegation warning (the “Switch” part “might not work correctly on large data sets”) and counted 166 High rows. Priority.Value = "High" counted 206.
  • Case. “it” doesn’t match “IT”, as Example 2 showed.
  • No default. Blank can leave a label empty; add a default or check it with the IsBlank function.
Delegation warning on Switch inside Filter with 166 versus 206 rows

Wrapping Up

Switch returns or runs the first exact match. Add a default, watch the case, and use Switch(true, …) for ranges.

For more formulas, browse all Power Apps functions, or read the If and Switch functions on Microsoft Learn.

Other Power Apps functions you may find useful: