Power Automate Switch Case [How to Use]

Recently, while working on a Power Automate flow for a client, where I needed to match a value with a list of values and return the first matching value. Then, I found that the Power Automate Switch Case is the best option. Let’s discuss this.

Power Automate switch case

Power Automate Switch control allows executing a specific branch of flow action depending on the switch input value passed.

Suppose you create a Switch control and add three cases. Then, the Power Automate switch action finds a match for the switch input value and implements the following switch cases.

Switch CaseStatementFlow ExecutionConclusion
Case 1MatchesYesCase 2 & Case 3 & Default case not executed.
Case 2MatchesYesCase 1 & Case 3 & Default case not executed.
Case 3MatchesYesCase 1& Case 2 & Default case not executed.

Similarly, it continues to check for other cases. If none of the cases matches, it will execute the default case. I hope you have an idea about the switch in Power Automate.

When we use Power Automate Switch Action?

Suppose you are working on a flow and need to handle multiple conditions. In that case, you add a switch action or nested condition statements. However, using nested condition statements can be a bit confusing, so it is better to use a switch case when you want to handle multiple conditions.

The switch case action handles multiple conditions to run the flow more efficiently. The Power Automate Switch action adds parallel cases for each value.

Use Switch Case in Power Automate

Before discussing how to use Switch control, I have created a SharePoint list (Task Details) with a few columns, as shown below:

Column NameData Type
Task Title [Title Column]Single line of text
Task DescriptionMulti lines of text
Assigned ToPerson or Group
Task PriorityChoice (Low, Medium, High & No Priority)
Task Start DateDate and time
Task DeadlineCalculated column
Task End DateDate and time
ManagerPerson or Group

I have created a Task Deadline (Calculated column) based on the below formula:

Task Deadline = [Task End Date]-2
power automate switch

Example:

In this example, I will use the SharePoint list Task Priority Choice column. So, based on the Task Priority value, the Power Automate switch cases will be executed as provided in the table below.

Switch CaseOperatorTask PriorityFlow ExecutionConclusion
Case 1is equal toLowYesCase 2 & Case 3 & Default case not executed.
Case 2is equal toMediumYesCase 1 & Case 3 & Default case not executed.
Case 3is equal toHighYesCase 1 & Case 2 & Default case not executed.
Default CaseOther valuesYesCase 1 & Case 2 & Case 3 not executed.

Follow the below steps to create a Power Automate flow:

1. Open the Power Automate Home page and click + Create, -> select Automated cloud flow. Give the flow name, and select trigger when an item is created or modified, then click the Create button.

Inside the trigger, select Site Address and List Name.

How to use Switch flow action in Power Automate

2. Add a Switch control flow action. Provide the below parameter:

By default, it displays with the Add Case icon and Default section.

switch case in power automate

Add First Case in Power Automate Switch Control

For the first case, check if the Task Priority Value is equal to Low, then post a message directly to the Assigned user about the details of a task using the Microsoft Teams connector. Let’s see the steps below:

1. Click + Add case to add the first switch case. Manually enter the value Low inside the parameter.

power automate switch case

2. Add a Post message in a chat or channel flow action. Set the required fields:

  • Post as: Select Flow bot from the drop-down.
  • Post In: Choose Chat with Flow bot from the drop-down.
  • Recipient: Take Assigned To from dynamic content.
  • Message: Enter the message.
power automate switch

After that, click on +Add case to add the second switch case.

Add Case 2 in Power Automate Switch Control

For case 2, check if the Task Priority Value is equal to Medium. Then, start the flow and check if the Task End Date is less than ten days. If it is, Send a reminder email to the assigned person about the Task end date. If it is over ten days, send a post message to the Assigned person about task details using the Microsoft Teams connector. To do this, follow the below steps:

1. Manually enter the value Medium inside the case2 parameter.

power automate switch case multiple values

2. Under Case 2, take condition control flow action, including the condition below.

Choose ValueOperatorValue
End Dateis less thanaddDays(utcNow(),10)
power automate case condition

3. Next, add Send an email(V2) flow action under True Condition. Configure the details:

  • To: Take Assigned To from the dynamic content
  • Subject: Write a subject line
  • Body: Enter a detailed description of the mail
power automate switch contains

4. Add a Post message in a chat or channel flow action under False Condition. Set the required fields:

  • Post as: Select Flow bot from the drop-down.
  • Post In: Choose Chat with Flow bot from the drop-down.
  • Recipient: Take Assigned To from dynamic content.
  • Message: Enter the message.
power automate switch case multiple values

Add Case 3 in Power Automate Switch Control

For case 3, check if the Task Priority Value is equal to the High, then create a team Teams Meeting with the Assigned person. Let’s see how we do this.

1. Enter switch input value equals High manually.

switch case in power automate

2. Add Create a Teams Meeting with required details as shown below:

  • Subject: Take Title from the dynamic content.
  • Message: Select Task Description from dynamic content.
  • Time Zone: Choose the local time zone from the drop-down.
  • Start Time: Take Task Deadline from dynamic content.
  • End Time: Add the below given expression that adds one hour to the Task Deadline.
  • Calendar Id: Select Calendar from the drop-down.
  • Required Attendees: Add Assigned To email from dynamic content.
  • Optional Attendees: Add Manager Email from dynamic content.
switch case power automate

Add Default Case in Power Automate Switch Control

If the Task Priority value is No Priority then Send an email to the Assigned To member about the details of the task.

Add the Send an email(V2) flow action and configure the details below, such as To, Subject, and Body.

power automate switch expression

Now, Save the flow. Test it Manually. Then, create an item in the SharePoint Online list, as shown in the screenshot below:

Power Automate Switch Control Statements, power automate case statement

The related switch case will be executed according to the switch input value when the flow runs successfully.

Output: [Case1]

power automate switch multiple values

Output: [Case2]

how to use switch in power automate

Output: [Case3]

power automate switch function

Output: [Default Case]

power automate switch multiple conditions

This is how to use a switch case action in Power Automate to include multiple condition values.

Download the Complete Flow

You can also download the complete flow and use it in your environment.

Conclusion

I hope you understand now everything about the Power Automate Switch and how to use the switch case in Power Automate.

You may also like:

>
User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…