Power Automate Functions Reference Guide
What is Power Fx?
Power Fx is a low-code, Excel-inspired formula language developed by Microsoft, primarily used within the Power Platform. It powers logic in tools like Power Apps, Dataverse, and now increasingly across services like Power Automate and Copilot Studio. Its syntax is easy to learn for business users, while still being robust enough for developers.
Power Fx is declarative and functional, meaning you describe what outcome you want, and the platform handles the how. This allows users to write logic that reacts to changes in data and user inputs without complex control flows.
In Power Automate, Power Fx allows you to dynamically set input parameters, define conditions, manipulate text and dates, and even shape collections without needing advanced expressions or code.
Why is Power Fx Helpful?
Familiar and approachable: If you're comfortable with Excel formulas, you already have a head start with Power Fx. This lowers the learning curve significantly.
Unified logic layer: Power Fx enables consistency across Power Apps, Power Automate, and Dataverse, letting you reuse and share logic easily.
Powerful yet concise: It allows for writing complex data manipulations, branching logic, and condition checks in just a few lines.
Live and reactive: In supported scenarios, Power Fx expressions can evaluate in real time based on flow inputs or data values.
Enables rapid development: With Power Fx in Power Automate, users can enhance flows without relying solely on the expression editor or complex nested functions.
Power Fx bridges the gap between spreadsheets and full-fledged development, empowering more people to build impactful automations and workflows.
Power Fx in Action: Examples (Power Automate Context)
Example 1: Format a Date from Trigger Input
Text(triggerOutputs()?['headers']['x-ms-file-last-modified'], "yyyy-MM-dd")
Description: Formats a file's last modified date from the trigger metadata.
Example 2: Extract First Name from a Full Name
First(Split(triggerBody()?['FullName'], " "))
Description: Splits the full name into parts and returns the first one.
Example 3: Check if a Field is Empty
IsBlank(triggerBody()?['Comments'])
Description: Returns true if the "Comments" field is blank.
Example 4: Compose a Full Name from First and Last
Concat(triggerBody()?['FirstName'], " ", triggerBody()?['LastName'])
Description: Combines first and last names into a full name string.
Example 5: Use a Conditional Expression
If(triggerBody()?['Amount'] > 1000, 'High', 'Low')
Description: Returns 'High' if amount is greater than 1000, else returns 'Low'.
Visualizing Power Fx in Power Automate
Below is a simplified diagram showing how Power Fx fits into Power Automate:
+--------------------------+
| Trigger Inputs |
+--------------------------+
|
v
+--------------------------+
| Power Fx Logic |
| (Compose, Conditions) |
+--------------------------+
|
v
+--------------------------+
| Flow Actions |
+--------------------------+
- Power Fx can be used in Compose, Condition, Select, Append to array, and other data shaping actions.
- It enables flow authors to perform inline transformations without complex expressions.
- Makes the logic more readable and maintainable for all skill levels.
Integration Scenarios: Power Fx + Dataverse + Copilot Studio
Power Fx with Dataverse
Power Fx can be used to filter, transform, and validate data pulled from or written to Dataverse tables. Example:
Filter(Accounts, StartsWith(Name, "Contoso"))
This filters the Accounts table in Dataverse to return only records starting with "Contoso".
Power Fx with Copilot Studio
In Copilot Studio, Power Fx expressions can be used to evaluate user input, manage variables, and respond with dynamic messages. Example:
If(UserInput = "help", "How can I assist you?", "Let's continue!")
This expression drives dialog behavior based on a user's input.
Let me know if you'd like a visual infographic version of this diagram or a downloadable cheat sheet with categorized Power Fx functions!
Text Functions
chunk(text, size)
Divides a string into equally sized chunks.concat(text1, text2, ...)
Merges multiple strings into one.endsWith(text, searchText)
Determines if a string ends with the given value.formatNumber(number, format, locale)
Formats a number based on the format string and locale.guid()
Generates a globally unique identifier.indexOf(text, searchText)
Finds the position of the first occurrence of a substring.isFloat(value)
Checks if the input is a float number.isInt(value)
Checks if the input is an integer.lastIndexOf(text, searchText)
Finds the position of the last occurrence of a substring.length(text)
Returns the length of a string.nthIndexOf(text, searchText, occurrence)
Finds the position of the nth occurrence of a substring.replace(text, oldText, newText)
Replaces all instances of a substring.slice(text, startIndex, endIndex)
Returns a part of the string based on indices.split(text, delimiter)
Splits a string into an array.startsWith(text, searchText)
Checks if the string starts with the given value.substring(text, startIndex, length)
Returns a substring of specified length from a position.toLower(text)
Converts the string to lowercase.toUpper(text)
Converts the string to uppercase.trim(text)
Removes white space from both ends of the string.
Collection Functions
chunk(collection, size)
Breaks a collection into parts of equal size.contains(collection, value)
Checks if a collection contains a specified value.empty(collection)
Returns true if the collection is empty.first(collection)
Returns the first item in the collection.intersection(collection1, collection2, ...)
Returns the common elements across collections.item()
Refers to the current item in a loop.join(collection, delimiter)
Joins all elements of a collection into a string.last(collection)
Returns the last item in a collection.length(collection)
Returns the number of elements in the collection.reverse(collection)
Reverses the order of elements in a collection.skip(collection, count)
Skips the first N elements in a collection.sort(collection, sortBy)
Sorts a collection by a key.take(collection, count)
Takes the first N elements from a collection.union(collection1, collection2, ...)
Merges collections, removing duplicates.
Logical Functions
and(expression1, expression2, ...)
Returns true if all expressions are true.equals(value1, value2)
Checks if two values are equal.greater(value1, value2)
Returns true if the first value is greater.greaterOrEquals(value1, value2)
Returns true if the first value is greater or equal.if(expression, trueValue, falseValue)
Returns one of two values depending on a condition.less(value1, value2)
Returns true if the first value is less.lessOrEquals(value1, value2)
Returns true if the first value is less or equal.not(expression)
Reverses a boolean expression.or(expression1, expression2, ...)
Returns true if any expression is true.
Conversion Functions
bool(value)
Converts value to a boolean.float(value)
Converts value to a floating-point number.int(value)
Converts value to an integer.string(value)
Converts value to a string.
Math Functions
add(number1, number2)
Adds two numbers.div(number1, number2)
Divides the first number by the second.max(value1, value2, ...)
Returns the largest value.min(value1, value2, ...)
Returns the smallest value.mod(dividend, divisor)
Returns the remainder after division.mul(number1, number2)
Multiplies two numbers.rand(min, max)
Returns a random integer within a range.sub(number1, number2)
Subtracts second number from the first.
Date and Time Functions
addDays(timestamp, days, format?)
Adds days to a timestamp.addHours(timestamp, hours, format?)
Adds hours to a timestamp.addMinutes(timestamp, minutes, format?)
Adds minutes to a timestamp.addSeconds(timestamp, seconds, format?)
Adds seconds to a timestamp.convertFromUtc(timestamp, timezone, format?)
Converts UTC to a time zone.convertToUtc(timestamp, timezone, format?)
Converts local time to UTC.formatDateTime(timestamp, format)
Formats a date/time value.getFutureTime(interval, unit, format?)
Gets a future time.getPastTime(interval, unit, format?)
Gets a past time.utcNow()
Gets the current UTC time.ticks(timestamp)
Converts to ticks since epoch.dayOfMonth(timestamp)
Gets the day of the month.dayOfWeek(timestamp)
Gets the day of the week.dayOfYear(timestamp)
Gets the day of the year.month(timestamp)
Gets the month.year(timestamp)
Gets the year.weekOfYear(timestamp)
Gets the ISO week number.
URI Functions
uriComponent(value)
Encodes a URI component.uriComponentToString(value)
Decodes a URI component.uriHost(uri)
Gets the host of the URI.uriPath(uri)
Gets the path of the URI.uriPort(uri)
Gets the port from the URI.uriQuery(uri)
Gets the query string.uriScheme(uri)
Gets the scheme (e.g., https).
Workflow Functions
coalesce(value1, value2, ...)
Returns first non-null value.triggerBody()
Gets body of the trigger.triggerOutputs()
Gets all trigger outputs.workflow()
Gets current workflow metadata.actionOutputs('name')
Gets outputs from an action.actions('name')?['outputs']?['body']
Access nested output values.
Misc / Advanced Functions
base64(value)
Encodes string to Base64.base64ToBinary(base64String)
Converts Base64 to binary.base64ToString(base64String)
Decodes Base64 to string.dataUri(value)
Encodes data as a URI.dataUriToBinary(uri)
Converts URI to binary.decodeBase64()
Decodes Base64 in connectors.
Tips
- Use Peek code for debugging.
- Combine multiple functions for advanced expressions.
- Test in the Expression editor to avoid runtime errors.