top of page

Subscribe to our newsletter

Power Automate Expressions – Quick Guide

  • Writer: Sivakumar K
    Sivakumar K
  • Oct 4, 2025
  • 5 min read


Expressions in Power Automate are small formulas that help you transform data, apply conditions, and automate logic within flows. Instead of adding extra steps, you can use expressions to clean data, calculate values, or make decisions directly inside actions.

Here are the main categories of expressions you’ll use most often:


  • String Functions

  • Collections / Array Functions

  • Logical Functions

  • Math Functions

  • Date & Time Functions

  • Conversion Functions

  • Manipulation Functions

  • URI Parsing Functions

  • Workflow / Trigger Functions


String Functions


String functions let you work with text values. They are useful when you need to join names, remove spaces, change text to lowercase/uppercase, or replace certain words. These functions are often used in email formatting, document creation, or cleaning up inputs from forms.

Function

Purpose

Example

Result

concat(text1, text2, …)

Joins strings together.

concat('Hello ', 'World')

Hello World

substring(text, start, length)

Extracts part of text.

substring('PowerAutomate', 0, 5)

Power

length(text)

Gets length of a string/array.

length('Hello')

5

toUpper(text)

Converts to uppercase.

toUpper('abc')

ABC

toLower(text)

Converts to lowercase.

toLower('ABC')

abc

trim(text)

Removes spaces from start & end.

trim(' hello ')

hello

replace(text, old, new)

Replace part of string.

replace('cat','c','b')

bat

indexOf(text, value)

Finds position of substring.

indexOf('Hello','o')

4

lastIndexOf(text, value)

Finds last position.

lastIndexOf('Hello','l')

3

startsWith(text, value)

Checks if string starts with value.

startsWith('Power','Po')

TRUE

endsWith(text, value)

Checks if string ends with value.

endsWith('Power','er')

TRUE

split(text, delimiter)

Splits into array.

split('a,b,c', ',')

['a','b','c']

Collections / Array Functions


Array functions help you work with multiple values at once. You can pick the first or last item, count total items, combine two lists, or filter data. They are useful when dealing with SharePoint lists, Excel rows, or JSON arrays returned from APIs.

Function

Purpose

Example

Result

createArray(v1,v2,…)

Creates an array.

createArray(1,2,3)

[1,2,3]

union(array1,array2)

Combines arrays, removes duplicates.

union([1,2],[2,3])

[1,2,3]

intersection(a1,a2)

Common values.

intersection([1,2],[2,3])

[2]

except(a1,a2)

Values in first not in second.

except([1,2,3],[2])

[1,3]

join(array, delimiter)

Join array into string.

join(['a','b'], '-')

a-b

first(array)

First element.

first([10,20,30])

10

last(array)

Last element.

last([10,20,30])

30

skip(array, n)

Skip first n elements.

skip([1,2,3],1)

[2,3]

take(array, n)

Take first n elements.

take([1,2,3],2)

[1,2]

Logical Functions


Logical functions are used to set conditions and control the flow path. They let you check if two values match, evaluate true/false outcomes, or run an action only if a condition is met. This is essential in approvals, decision-making, and error handling.

Function

Purpose

Example

Result

if(condition, trueValue, falseValue)

Inline If.

if(greater(5,3),'Yes','No')

Yes

equals(v1,v2)

Checks equality.

equals(5,5)

TRUE

greater(v1,v2)

Greater than.

greater(10,5)

TRUE

less(v1,v2)

Less than.

less(2,5)

TRUE

greaterOrEquals(v1,v2)

greaterOrEquals(5,5)

TRUE

lessOrEquals(v1,v2)

lessOrEquals(4,5)

TRUE

and(cond1,cond2)

Logical AND.

and(equals(1,1),equals(2,2))

TRUE

or(cond1,cond2)

Logical OR.

or(equals(1,1),equals(2,3))

TRUE

not(condition)

Negates condition.

not(equals(1,2))

TRUE

Match Functions

Math functions let you perform calculations directly in your flows. You can add or subtract values, multiply or divide numbers, calculate remainders, or even generate random numbers. This is often used in reporting, ID generation, or handling numeric fields.

Function

Purpose

Example

Result

add(n1,n2)

Add numbers.

add(5,3)

8

sub(n1,n2)

Subtract.

sub(10,5)

5

mul(n1,n2)

Multiply.

mul(5,3)

15

div(n1,n2)

Divide.

div(10,2)

5

mod(n1,n2)

Remainder.

mod(10,3)

1

int(value)

Convert to integer.

int('123.9')

123

float(value)

Convert to float.

float('123.45')

123.45

round(num,decimals)

Round to decimals.

round(12.345,2)

12.35

ceiling(num)

Round up.

ceiling(4.2)

5

floor(num)

Round down.

floor(4.8)

4

rand(min,max)

Random number.

rand(1,100)

57

Date & Time Functions


Date and time functions help you calculate and format time-based data. You can add or subtract days, convert time zones, and format dates for reports or notifications. They’re commonly used in approval deadlines, reminders, and scheduling workflows.


Function

Purpose

Example

Result

utcNow()

Current UTC datetime.

utcNow()

2025-10-03T09:00:00Z

addDays(date, n, format?)

Add days.

addDays('2025-10-03',5,'yyyy-MM-dd')

08-10-2025

addHours(date,n,format?)

Add hours.

addHours(utcNow(),2)

2025-10-03T11:00:00Z

addMinutes(date,n)

Add minutes.

addMinutes(utcNow(),30)

+30 minutes

addSeconds(date,n)

Add seconds.

addSeconds(utcNow(),60)

+1 minute

subtractFromTime(date,n,unit)

Subtract time.

subtractFromTime(utcNow(),1,'Day')

Yesterday

ticks(date)

Returns ticks since 1/1/0001.

ticks(utcNow())

Large number

formatDateTime(date,format)

Formats date/time.

formatDateTime(utcNow(),'dd-MM-yyyy')

03-10-2025

dayOfWeek(date)

Day of week index.

dayOfWeek('2025-10-03')

5 (Friday)

dayOfMonth(date)

Day of month.

dayOfMonth('2025-10-03')

3

month(date)

Month number.

month('2025-10-03')

10

year(date)

Year.

year('2025-10-03')

2025

Conversion Functions


Conversion functions allow you to switch data between formats or types. For example, turning numbers into text, parsing JSON strings into objects, or decoding encoded data. These are helpful when moving data between different systems that require specific formats.


Function

Purpose

Example

Result

string(value)

Convert to string.

string(123)

"123"

bool(value)

Convert to Boolean.

bool('true')

TRUE

json(value)

Parse a string into JSON.

json('{"a":1}')?['a']

1

base64(value)

Convert to Base64 string.

base64('hello')

aGVsbG8=

base64ToString(value)

Decode Base64 → string.

base64ToString('aGVsbG8=')

hello

uriComponent(value)

Encode string for URI.

uriComponent('Power Automate')

Power%20Automate

uriComponentToString(value)

Decode URI string.

uriComponentToString('Power%20Automate')

Power Automate

Manipulation Functions


Manipulation functions in Power Automate are designed to work with objects and structured data like JSON or XML. They let you add, update, or remove properties from an object, return the first non-null value, and even extract values from XML using XPath. These functions are especially useful when handling API responses, dynamic data, or custom objects inside your flows.


Function

Purpose

Example

Result

coalesce(object1, object2, …)

Returns the first non-null value in the list of inputs

coalesce(null, 'Power', 'Automate')

Power

addProperty(object, property, value)

Returns an object with an additional property/value pair

addProperty(json('{"name":"Siva"}'), 'role', 'Admin')

{"name":"Siva","role":"Admin"}

setProperty(object, property, value)

Returns an object with the specified property set to a value (updates if exists)

setProperty(json('{"name":"Siva"}'), 'name', 'Kumar')

{"name":"Kumar"}

removeProperty(object, property)

Returns an object with the specified property removed

removeProperty(json('{"name":"Siva","role":"Admin"}'), 'role')

{"name":"Siva"}

xpath(xml, xpath)

Returns a node, nodeset, or value as JSON from the provided XML using XPath

xpath(xml('<user><id>123</id></user>'), 'string(//id)')

123

URI Parsing Functions


URI parsing functions in Power Automate are used to extract specific parts of a Uniform Resource Identifier (URI). They allow you to get details such as the host, path, query string, port, and scheme from a full URL. These functions are particularly helpful when working with API calls or web requests, where you often need to break down a URL into its components.


Function

Purpose

Example

Result

uriHost(uri)

Returns the host (domain) from a URI

uriPath(uri)

Returns the path from a URI. If no path, returns /

/products

uriPathAndQuery(uri)

Returns the path and query string from a URI

/products?id=1

uriPort(uri)

Returns the port number from a URI. If none, returns the default port (80/443)

8080

uriScheme(uri)

Returns the scheme (protocol) from a URI

https

uriQuery(uri)

Returns the query part of a URI

id=1

Workflow Functions


These functions give you details about the flow itself and its trigger. You can fetch information about when the flow was triggered, pull outputs from earlier actions, or check flow metadata. This is helpful for auditing, dynamic references, and debugging flows.


Function

Purpose

Example

Result

listCallbackUrl()

Returns the URL to invoke the trigger or action. Commonly used to generate a callback endpoint for a specific action.

listCallbackUrl()

workflow()

Provides runtime details of the workflow itself such as name, ID, environment, version, etc.

workflow()

{ "id": "/workflows/1234", "name": "MyFlow", "type": "workflow", "version": "08585..." }


Comments


bottom of page