Showing results for 
Search instead for 
Did you mean: 
Advocate I
Advocate I

Switch with Calculated Case

Is there a reason we cannot have an evaluated expression in the Case field within a Switch? I'd like to be able to set my Switch On Equal to True, and then have the case evaluate for True. For example:


Switch on True

  CASE 1 (IF A = TRUE and B = FALSE)

  CASE 2 (IF A = FALSE and B = TRUE)

  CASE 3 (IF A = TRUE and B = TRUE) 



Otherwise I have to do a nested IF/THEN function (nightmare to troubleshoot and read), and set a value to a variable, and then match on the variable outcome if I want to use the switch...Just easier to do the nested IF/THEN statements, but ugly and not as clean as going right to a switch case if I need to later modify that path...



IF (A = TRUE) and (B = FALSE)
       varEmailSwitch = 1
        IF (A = FALSE) and (B = TRUE)
                  varEmailSwitch = 2
                   IF (A = TRUE) and (B = TRUE)
                           varEmailSwitch = 3
                           varEmailSwitch = 0 (Default)

Advocate I
Advocate I

Re: Switch with Calculated Case

I did end up using the following as the logic in the Switch test:


if(and(equals(items('Apply_to_each')?['dgBypassA'], false),equals(items('Apply_to_each')?['dgBypassB'], True)),1,if(and(equals(items('Apply_to_each')?['dgBypassA'], True),equals(items('Apply_to_each')?['dgBypassB'], false)),2,if(and(equals(items('Apply_to_each')?['dgBypassA'], true),equals(items('Apply_to_each')?['dgBypassB'], true)),3,0)))
Then having 1, 2, 3 and default action (0) in the case, it just would have been "cleaner" (I know subject to interpretation), to do the test for the case in the "equals" section and far easier to modify in the future should I need to add additional checks to each case.

Helpful resources


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021


Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,570)