DEV Community

Muhammad Yasir
Muhammad Yasir

Posted on

Power Automate Functions (fx): A New Feature for Smarter Workflows

Introduction
Microsoft Power Automate is an incredible tool for automating workflows across different apps and services. One of its standout features is functions (fx) — these let you manipulate data, perform calculations, and control logic within your flows.

Why Power Automate Functions Are a Game-Changer

✅ Works Everywhere — Use them across Power Automate, Power Apps, and other Microsoft tools for seamless automation.

✅ Reusable — Write once, use anywhere, cutting down redundancy and saving time.

✅ Nested Functions — Stack functions inside each other to create more flexible, modular workflows.

In this guide, we’ll break down some of the most useful Power Automate functions and how they can make your automation smarter and more efficient. Let’s dive in! 🚀

1️⃣ What Are Functions (fx) in Power Automate?

Functions in Power Automate allow users to perform operations on data, including string manipulation, date/time calculations, logical evaluations, and mathematical computations. These functions are similar to Excel formulas and Power Apps expressions.

Power Automate functions are categorized into different types:

**- String Functions (e.g., concat(), substring())

  • Date and Time Functions (e.g., utcNow(), addDays())
  • Logical Functions (e.g., if(), equals())
  • Conversion Functions (e.g., int(), float())
  • Array Functions (e.g., join(), length())
  • Workflow Functions (e.g., coalesce(), base64ToString())**

2️⃣ String Functions: Manipulating Text in Power Automate

🔹 concat(text1, text2, …) – Combine Multiple Strings
This function joins multiple text values into a single string.

concat('Hello ', 'Power Automate!')
Enter fullscreen mode Exit fullscreen mode

Output: Hello Power Automate!

🔹 substring(text, start, length) – Extract Part of a String
Extracts a portion of a string based on the start position and length.

substring('PowerAutomate', 0, 5)
Enter fullscreen mode Exit fullscreen mode

Output: Power

🔹 replace(text, oldValue, newValue) – Replace Text in a String
Replaces occurrences of a specified substring within a string.

replace('Welcome to Power Automate', 'Power Automate', 'Flow')
Enter fullscreen mode Exit fullscreen mode

Output: Welcome to Flow

3️⃣ Date and Time Functions: Working with Timestamps

🔹 utcNow() – Get the Current UTC Date and Time

Returns the current timestamp in UTC format.

utcNow()
Enter fullscreen mode Exit fullscreen mode

Output Example: 2024-02-18T10:15:30Z

🔹 addDays(timestamp, days, format?) – Add Days to a Date

addDays(utcNow(), 5, 'yyyy-MM-dd')
Enter fullscreen mode Exit fullscreen mode

Output Example: 2024-02-23

🔹 formatDateTime(timestamp, format) – Format a Date

Formats a date into a specific format.

formatDateTime(utcNow(), 'MM/dd/yyyy')
Enter fullscreen mode Exit fullscreen mode

Output Example: 02/18/2024

4️⃣ Logical Functions: Making Decisions in Flows

🔹 if(condition, valueIfTrue, valueIfFalse) – Conditional Logic

if(equals(10, 10), 'Match', 'No Match')
Enter fullscreen mode Exit fullscreen mode

Output: Match

🔹 equals(value1, value2) – Compare Two Values

equals(5, 10)
Enter fullscreen mode Exit fullscreen mode

Output: false

🔹 coalesce(value1, value2, …) – Return the First Non-Empty Value

coalesce('', 'Power Automate', 'Default')
Enter fullscreen mode Exit fullscreen mode

Output: Power Automate

5️⃣ Array Functions: Handling Lists and Collections

🔹 length(array) – Get the Number of Items in an Array

length(createArray('A', 'B', 'C'))
Enter fullscreen mode Exit fullscreen mode

Output: 3

🔹 join(array, separator) – Convert an Array to a String

join(createArray('A', 'B', 'C'), ', ')
Enter fullscreen mode Exit fullscreen mode

Output: A, B, C

6️⃣ Conversion Functions: Changing Data Types

🔹 int(value) – Convert a String to an Integer

int('100')
Enter fullscreen mode Exit fullscreen mode

Output: 100

🔹 float(value) – Convert a String to a Decimal Number

float('99.99')
Enter fullscreen mode Exit fullscreen mode

Output: 99.99

🔹 string(value) – Convert a Value to Text

string(2024)
Enter fullscreen mode Exit fullscreen mode

Output: '2024'

Test Case

  1. Create Function(fx) in Power Automate Solution to calcualte the last day of the month. Creating new Function(fx)
  2. Set parameter, output and Formula. Setting Formula(fx)
  3. Perform an unbound action using dataverse and set parameter givenDate set current date ‘2025–02–19T04:13:14.6097779Z’
  4. Test run Test Output

🚀 Next Steps:

Try using functions in your flows.
Explore more Power Automate expressions.
Share your experiences in the comments!
Happy automating! 🤖⚡

Top comments (0)