Introduction
In Microsoft Power Automate, handling missing, null, or unavailable values is an important part of building reliable automated workflows.
When working with SharePoint lists, Power Apps, Microsoft Forms, Excel, or other data sources, sometimes a field does not contain a value. If we use that field directly in our flow, it can result in unexpected outputs, incorrect conditions, or errors.
Power Automate provides a useful expression called coalesce() to handle null values and provide fallback values.
The coalesce() expression returns the first value that is not null from the supplied values. It helps simplify expressions and makes flows easier to maintain.

1. What is the Coalesce() Expression?
The coalesce() expression checks multiple values from left to right and returns the first value that is not null.
Syntax:
coalesce(value1, value2, value3, ...)
Where:
value1: First value to check.
value2: Second value to check if the first is null.
value3: Third value to check if the previous values are null.
You can provide additional fallback values as needed.
Example:
coalesce(
null,
null,
'Power Automate',
'Default Value'
)
Output:
Power Automate
How does it work?
Power Automate checks the first value.
The first value is null, so it moves to the second value.
The second value is also null.
The third value contains Power Automate.
The expression returns Power Automate without checking the remaining value.
2. Practical Example – Get a SharePoint Field Value
Let's understand how to use coalesce() with a real-world example.
Scenario:
Suppose you have a SharePoint list named EmployeeDetails with the following columns:
Employee Name | Department | Location |
|---|
Ketan | IT | Ahmedabad |
Vimal | HR | (Empty) |
Mitesh | (Null) | Mumbai |
You want to retrieve the employee's department. If the department value is null, you want to display Not Assigned.
Step 1: Create a Power Automate flow
Open Power Automate.
Select Create.
Choose Instant cloud flow.
Add a SharePoint action named Get items.
Select your SharePoint site and EmployeeDetails list.
Step 2: Add a Compose action
Select New step.
Search for Compose.
Open the Expression tab.
Enter the following expression:
coalesce(
item()?['Department'],
'Not Assigned'
)
This example assumes the expression is used inside an Apply to each loop over the SharePoint items. If you use a Compose action outside the loop, reference the appropriate item from your flow instead.
Step 3: Check the output
Employee | Department value | Output |
|---|
Ketan | IT | IT |
Vimal | Null | Not Assigned |
Mitesh | Null | Not Assigned |
The expression returns the department when it is available; otherwise, it returns the fallback value.
3. Example – Use Multiple Fallback Values
Another useful scenario is when employee information comes from multiple sources.
Suppose you have three fields:
Preferred Name
Display Name
Email
You want to display the first available value.
Expression:
coalesce(
triggerBody()?['PreferredName'],
triggerBody()?['DisplayName'],
triggerBody()?['Email'],
'Unknown User'
)
Example results:
Preferred Name | Display Name | Output |
|---|
Ketan | Ketan Sathavara | Ketan |
Null | Vimal Patel | Vimal Patel |
Null | Null | @email.com |
Null | Null | Unknown User |
This approach is useful when working with optional fields or multiple data sources.
4. Important Difference Between Null and Empty Values
One important point to understand is that Power Automate's coalesce() does not treat an empty string ('') as null.
For example:
coalesce('', 'Default Value')
Output:
''
It returns an empty string because an empty string is still a non-null value.
If you want to handle both null and empty strings, use the empty() function with if().
Expression:
if(
empty(triggerBody()?['Department']),
'Not Assigned',
triggerBody()?['Department']
)
This expression checks whether the Department field is null or empty. If it is, it returns Not Assigned; otherwise, it returns the actual department.
Microsoft documentation explains this distinction in its Power Automate expression cookbook.
5. Practical Example – Avoid Null Values in Email Notifications
Suppose you are creating an automated approval notification using SharePoint.
Your SharePoint list contains:
Invoice Number
Vendor Name
Approver Name
Comments
Sometimes the Comments field is empty.
Instead of passing a null value into your email body, you can use:
coalesce(
triggerBody()?['Comments'],
'No comments provided'
)
You can use this expression directly in the email body through the Expression tab.
Expected output:
Invoice Number | Comments | Email Output |
|---|
INV-1001 | Approved | Approved |
INV-1002 | Please review invoice | Please review invoice |
INV-1003 | Null | No comments provided |
Remember: if Comments can be an empty string rather than null, use the if(empty(...)) approach from the previous section.
Benefits of Using Coalesce()
Using coalesce() provides several advantages when developing Power Automate workflows.
Handle null values: Provides a fallback when a value is unavailable.
Simplify expressions: Avoids writing multiple nested conditions.
Improve readability: Makes expressions easier to understand and maintain.
Support multiple sources: Retrieves the first available non-null value.
Reduce unnecessary actions: In suitable scenarios, you can avoid separate Condition actions just to provide a null fallback.
Conclusion
The coalesce() expression is a simple but powerful feature in Microsoft Power Automate. It helps developers handle null values, provide default values, and simplify workflow expressions.
Whether you are working with SharePoint, Power Apps, Microsoft Forms, or other connectors, coalesce() can make your flows more reliable and easier to maintain.
However, remember that Power Automate's coalesce() handles null values, not empty strings. Use empty() with if() when you need to handle both.
Start using coalesce() in your flows to build cleaner and smarter Power Automate solutions!
Join the conversation! Your thoughts help the community grow.