Introduction

Power Automate expressions are formulas used in Microsoft Power Automate flows to manipulate data, apply logic, and control automation behavior dynamically.

They allow you to build smarter, more flexible automation flows by working with:

Why Expressions Matter

Expressions make your flows dynamic and intelligent. For example:

Without expressions, flows would be limited to simple, static automation.

Where Expressions Are Used

In Power Automate, expressions can be added in:

They are written using a function-style syntax like:

functionName(parameter1, parameter2)

Example:

concat('Hello ', triggerBody()?['FirstName'])

How Expressions Work

Expressions:

Example of nesting:

if(equals(length('Power'),5),'Correct','Incorrect')

In short, expressions are the logic engine behind smart automation in Power Automate.

🔤 String Functions

ExpressionDescriptionExample
concat(a, b, ...)Combine multiple stringsconcat('Flow','-','CheatSheet')"Flow-CheatSheet"
substring(text, start, length)Return part of a stringsubstring('PowerAutomate',0,5)"Power"
length(text)Number of characterslength('Functions')9
split(text, delim)Split string into arraysplit('A,B,C',',')['A','B','C']
toLower(text)Convert to lowercasetoLower('Hello')"hello"
trim(text)Remove leading/trailing spacestrim(' ABC ')"ABC"
replace(text, old, new)Replace substringreplace('one two',' ','-')"one-two"
indexOf(text, value)First position of valueindexOf('abcde','c')2
lastIndexOf(text, value)Last position of valuelastIndexOf('abcabc','c')5
startsWith(text, value)Check prefixstartsWith('Hello','He')true

📦 Collection / Array Functions

ExpressionDescriptionExample
join(array, delim)Join array elementsjoin(['a','b','c'],'-')"a-b-c"
first(array)First elementfirst(['One','Two'])"One"
last(array)Last elementlast(['One','Two'])"Two"
union(a,b)Combine arrays (unique values)union(array1,array2)
intersection(a,b)Common elementsintersection(array1,array2)
contains(array,item)Check if array contains itemcontains(['a','b'],'b')true
length(array)Count itemslength(['a','b','c'])3

🔀 Logical & Conditional Functions

ExpressionDescriptionExample
if(cond, valT, valF)Conditional logicif(equals(1,1),'match','no match')"match"
equals(a,b)Equality checkequals(2,2)true
greater(a,b)Greater thangreater(5,3)true
less(a,b)Less thanless(2,4)true
and(a,b,...)Logical ANDand(true,false)false
or(a,b,...)Logical ORor(true,false)true
not(value)Logical NOTnot(true)false
empty(value)Check if emptyempty('')true
coalesce(a,b,...)First non-null valuecoalesce(null,'default')"default"

📅 Date & Time Functions

ExpressionDescriptionExample
utcNow()Current UTC date/timeutcNow()
addDays(date,n)Add daysaddDays('2025-10-01',2)"2025-10-03"
addHours(date,n)Add hoursaddHours('2025-10-26T10:00:00Z',3)
formatDateTime(date,fmt)Format dateformatDateTime('2025-10-26','yyyy-MM-dd')
dayOfWeek(date)Day index (0=Sunday)dayOfWeek('2025-10-26')0

Conclusion

Expressions in Power Automate allow you to manipulate data, perform calculations, and control logic dynamically, making workflows more flexible and efficient. They are essential for transforming inputs and automating complex tasks without manual intervention.