Live Developer Training: next batch coming soon. Be the first to know.Live training: next batch soonJoin the waitlist →Join →

Power Automate IF Expression: Syntax, If-Else, Nested IF and Real Examples

A flow I built for a client’s project team kept sending the same email for every task, whether it was urgent or not, finished or not. What it needed was one small decision: if the task is high priority, say so, otherwise keep it short. In Power Automate, that decision is the if() expression.

Below I’ll show you the syntax, how it evaluates, how to use it with SharePoint dynamic content, how to nest it for if-else-if logic, when the Condition action is the better choice, and how to fix the errors people hit most often.

Quick answer: Use if(condition, valueIfTrue, valueIfFalse) in a Compose action, a variable or any input field, for example if(equals(triggerBody()?['Priority']?['Value'], 'High'), 'Urgent', 'Normal'). The condition must return a Boolean, so build it with equals(), greater(), empty(), and() or or(). For if-else-if, put another if() in the false argument.

How the if() expression works

Cloud flows use the Workflow Definition Language for expressions, not Power Fx (that’s the Power Apps formula language). The if() function takes three required arguments and returns whichever value matches the result of the test. You can browse the other functions from the Power Automate tutorials hub.

if(<expression>, <valueIfTrue>, <valueIfFalse>)
ArgumentTypeWhat it does
expressionBooleanThe test, for example equals(1, 1) or greater(5, 3)
valueIfTrueAnyReturned when the test is true
valueIfFalseAnyReturned when the test is false
Power Automate if expression syntax tooltip in the expression editor

The values can be text, numbers, Booleans, objects or other expressions, so if() can feed a Compose action, an email subject, a SharePoint column or a variable. Microsoft documents that the parameters are evaluated from left to right.

To try it, add a Compose action, open the expression editor (the fx icon), and enter if(equals(2, 2), 'Yes', 'No'). Run the flow and the output is Yes. If you’d rather store the result, initialize a variable in Power Automate and use the expression as its value.

Compose action output showing Yes from the if equals expression

Use if() with dynamic content and SharePoint list values

Most real expressions test a value from the trigger or an earlier action. When you pick dynamic content in the expression editor, Power Automate writes the reference for you, such as triggerBody()?['Revenue']. Each SharePoint column type comes through a little differently:

Column typeExample if() expression
Numberif(greater(triggerBody()?['Revenue'], 10000), 'Large deal', 'Standard')
Choiceif(equals(triggerBody()?['Status']?['Value'], 'Approved'), 'Go', 'Wait')
Yes/Noif(triggerBody()?['IsCompleted'], 'Done', 'Open')
Personif(empty(triggerBody()?['AssignedTo']?['Email']), 'Unassigned', 'Assigned')
Textif(equals(toLower(triggerBody()?['Department']), 'finance'), 'Finance', 'Other')

A Choice column is an object, so you compare its Value, not the column itself. A Yes/No column is already a Boolean, so it can be the test on its own. For more column comparisons, see checking if a SharePoint column equals a value.

Here’s a simple numeric test in a Compose action, if(greater(15, 10), 'High', 'Low'), and its output:

Compose action with the if greater expression returning High or Low