Skip to main content
Low-Code Kit

Power Automate Expressions Cheat Sheet

Quick reference for Power Automate cloud flow expressions — string, date, collection, logical, and conversion functions.

Last verified: 2026-03-29 expressionspower-automatecloud-flowsreference

How to Use This Cheat Sheet

Power Automate expressions let you transform data, handle conditions, and manipulate values inside cloud flows. You write them in the expression editor (the fx button) or inline using the @{expression} syntax in dynamic content fields.

Every expression follows the pattern: functionName(parameter1, parameter2, ...). Functions can be nested — the inner function evaluates first.


String Functions

FunctionSyntaxExampleResult
concatconcat(text1, text2, ...)concat('Hello', ' ', 'World')Hello World
substringsubstring(text, startIndex, length)substring('Power Automate', 6, 8)Automate
replacereplace(text, oldText, newText)replace('2026-03-29', '-', '/')2026/03/29
splitsplit(text, delimiter)split('a;b;c', ';')["a","b","c"]
trimtrim(text)trim(' hello ')hello
toLowertoLower(text)toLower('HELLO')hello
toUppertoUpper(text)toUpper('hello')HELLO
indexOfindexOf(text, searchText)indexOf('Power Automate', 'Auto')6
containscontains(text, searchText)contains('Power Automate', 'Auto')true
startsWithstartsWith(text, searchText)startsWith('Power Automate', 'Power')true
endsWithendsWith(text, searchText)endsWith('report.pdf', '.pdf')true
lengthlength(text)length('Hello')5
nthIndexOfnthIndexOf(text, search, n)nthIndexOf('a-b-c', '-', 2)3
sliceslice(text, startIndex)slice('Hello World', 6)World
chunkchunk(text, length)chunk('abcdef', 2)["ab","cd","ef"]

String Tips

  • indexOf returns -1 if the search text is not found — use this for conditional checks.
  • substring throws an error if startIndex + length exceeds the string length. Guard with min(length(text), desiredLength).
  • split returns an array — access elements with first(), last(), or bracket notation in a compose action.

Date and Time Functions

FunctionSyntaxExampleResult
utcNowutcNow()utcNow()2026-03-29T14:30:00.0000000Z
addDaysaddDays(timestamp, days, format?)addDays(utcNow(), 7)7 days from now
addHoursaddHours(timestamp, hours, format?)addHours(utcNow(), -3)3 hours ago
addMinutesaddMinutes(timestamp, mins, format?)addMinutes(utcNow(), 30)30 mins from now
addSecondsaddSeconds(timestamp, secs)addSeconds(utcNow(), 90)90 secs from now
formatDateTimeformatDateTime(timestamp, format)formatDateTime(utcNow(), 'dd/MM/yyyy')29/03/2026
convertFromUtcconvertFromUtc(timestamp, tz, format?)convertFromUtc(utcNow(), 'GMT Standard Time', 'HH:mm')14:30
convertToUtcconvertToUtc(timestamp, tz)convertToUtc('2026-03-29T10:00', 'Eastern Standard Time')UTC equivalent
ticksticks(timestamp)ticks('2026-01-01')Tick count (100-ns intervals)
dayOfWeekdayOfWeek(timestamp)dayOfWeek('2026-03-29')0 (Sunday)
dayOfMonthdayOfMonth(timestamp)dayOfMonth('2026-03-29')29
dayOfYeardayOfYear(timestamp)dayOfYear('2026-03-29')88
startOfDaystartOfDay(timestamp)startOfDay(utcNow())2026-03-29T00:00:00
startOfMonthstartOfMonth(timestamp)startOfMonth(utcNow())2026-03-01T00:00:00
startOfHourstartOfHour(timestamp)startOfHour(utcNow())Start of current hour

Common Date Format Strings

TokenMeaningExample
yyyy4-digit year2026
MM2-digit month03
dd2-digit day29
HH24-hour hour14
hh12-hour hour02
mmMinutes30
ssSeconds00
ttAM/PMPM
ddddDay nameSunday
MMMMMonth nameMarch

Calculating Date Differences

Power Automate does not have a single dateDifference function that returns a clean number. Use ticks to calculate differences:

div(sub(ticks(variables('EndDate')), ticks(variables('StartDate'))), 864000000000)

That gives you the number of whole days. The magic number 864000000000 is the number of ticks in one day (10,000,000 ticks/second x 86,400 seconds/day).

For hours, divide by 36000000000. For minutes, divide by 600000000.


Collection Functions

FunctionSyntaxDescription
firstfirst(collection)Returns the first element
lastlast(collection)Returns the last element
lengthlength(collection)Returns the count of elements
containscontains(collection, value)Checks if a value exists in the array
emptyempty(collection)Returns true if the array has no elements
unionunion(collection1, collection2)Merges two arrays, removing duplicates
intersectionintersection(coll1, coll2)Returns elements common to both arrays
skipskip(collection, count)Skips the first N elements
taketake(collection, count)Takes the first N elements
joinjoin(collection, delimiter)Joins array elements into a string
sortsort(collection)Sorts array in ascending order
reversereverse(collection)Reverses the array order

Accessing Array Elements

Use bracket notation inside a Compose action or variable:

outputs('Parse_JSON')?['body']?[0]?['name']

The ? operator is the safe navigation operator — it returns null instead of throwing an error when a property does not exist.


Logical Functions

FunctionSyntaxExampleResult
ifif(condition, trueVal, falseVal)if(equals(1,1), 'yes', 'no')yes
equalsequals(val1, val2)equals(variables('status'), 'Active')true / false
andand(expr1, expr2)and(greater(5,3), less(2,4))true
oror(expr1, expr2)or(equals(x,1), equals(x,2))true if either matches
notnot(expression)not(equals(1,2))true
greatergreater(val1, val2)greater(10, 5)true
greaterOrEqualsgreaterOrEquals(val1, val2)greaterOrEquals(5, 5)true
lessless(val1, val2)less(3, 10)true
lessOrEqualslessOrEquals(val1, val2)lessOrEquals(5, 5)true
emptyempty(value)empty('')true
coalescecoalesce(val1, val2, ...)coalesce(null, null, 'default')default

Nested Conditions

You can nest if expressions, but beyond two levels it becomes unreadable. Use a Switch action or a Compose with a lookup object instead:

if(equals(variables('status'), 'A'), 'Active',
  if(equals(variables('status'), 'I'), 'Inactive', 'Unknown'))

Conversion Functions

FunctionSyntaxDescription
intint(value)Converts to integer — int('42') returns 42
floatfloat(value)Converts to float — float('3.14') returns 3.14
stringstring(value)Converts any value to string
boolbool(value)Converts to boolean — bool(1) returns true
jsonjson(text)Parses a JSON string into an object
xmlxml(value)Converts JSON or string to XML
base64base64(value)Encodes to Base64
base64ToStringbase64ToString(value)Decodes Base64 to string
base64ToBinarybase64ToBinary(value)Decodes Base64 to binary
binarybinary(value)Converts value to binary
decodeBase64decodeBase64(value)Alias for base64ToString
decodeUriComponentdecodeUriComponent(text)Decodes URL-encoded text
encodeUriComponentencodeUriComponent(text)URL-encodes text
arrayarray(value)Wraps a single value in an array
createArraycreateArray(val1, val2, ...)Creates an array from values

Common Patterns

Conditional Text in an Email or Message

if(greater(variables('Amount'), 1000), 'High value order', 'Standard order')

Null Handling with Coalesce

When a dynamic content value might be null, wrap it in coalesce to provide a fallback:

coalesce(triggerOutputs()?['body/company'], 'Not specified')

Extracting a File Name from a Path

last(split(variables('FilePath'), '/'))

Getting the Domain from an Email Address

last(split(variables('Email'), '@'))

Formatting a Number with Leading Zeros

To pad a number to 5 digits:

substring(concat('00000', string(variables('OrderNumber'))), sub(length(concat('00000', string(variables('OrderNumber')))), 5))

A cleaner alternative if you have the formatNumber function available:

formatNumber(variables('OrderNumber'), '00000')

Parse JSON and Access Nested Values

After a Parse JSON action named Parse_JSON:

body('Parse_JSON')?['customer']?['address']?['postCode']

Always use the safe navigation operator ? to avoid null reference errors.

Dynamic Content Expressions for Trigger Outputs

triggerOutputs()?['body/value']
triggerBody()?['fieldName']

Check If a String Is a Valid Date

There is no built-in isDate function. A practical workaround is to use formatDateTime inside a Try scope — if it fails, the string is not a valid date.

Working with Time Zones in the UK

convertFromUtc(utcNow(), 'GMT Standard Time', 'dd/MM/yyyy HH:mm')

Note: GMT Standard Time in Windows time zone IDs automatically handles British Summer Time (BST) switching.

Removing HTML Tags from Text

replace(replace(replace(body('Get_item')?['Description'], '<br>', ' '), '<[^>]+>', ''), '&nbsp;', ' ')

For robust HTML stripping, use the built-in Html to text action instead of expressions.


Expression Error Reference

ErrorLikely CauseFix
InvalidTemplateSyntax error in expressionCheck brackets, quotes, commas
Unable to process template languageMissing or extra parametersVerify function signature
The template function is not validMisspelt function nameCheck capitalisation (camelCase)
Cannot convert value to typeWrong data type passedUse conversion functions first
Index was out of rangeArray/string index too largeGuard with length() check

Quick Reference: Expression Editor Shortcuts

  • Type @ in a text field to switch between dynamic content and expression mode.
  • Use the Expression tab and type the function name — IntelliSense will suggest completions.
  • Click a dynamic content token while in the expression editor to insert its reference path.
  • Test expressions in a Compose action before using them in complex actions — it makes debugging far easier.