Coalesce

How to Use the Power Fx CoalesceĀ  Function in Power Apps

What is the Coalesce Function?

The Coalesce function is used to handle null or blank values in your data sources. It takes two or more values as parameters and returns the first value that is not null or blank. If all the values are null or blank, it returns blank. This function is useful when you are working with data that may have null or blank values.

Syntax of the Coalesce Function

The syntax of the Coalesce function is as follows:


Coalesce(value1, value2, value3, ...)


You can specify two or more values as parameters. The function returns the first value that is not null or blank. If all the values are null or blank, it returns blank.

How to Use the Coalesce Function in Power Apps

To use the Coalesce function in Power Apps, follow these steps:

1. Open the Power Apps Studio and create a new app.

2. Add a data source to your app. You can use any data source, such as SharePoint, Excel, or SQL Server.

3. Add a control to your app. You can use any control, such as a label, text box, or gallery.

4. Set the Text property of the control to the Coalesce function. For example, if you want to display the name of a customer and the name is not available, you can use the following formula:


Coalesce(Customer.Name, "Name not available")


This formula checks if the name of the customer is available. If it is not available, it displays “Name not available” in the control.

You can also use the Coalesce function to handle null or blank values in your formulas. For example, if you want to calculate the total price of an order and the price of some items is not available, you can use the following formula:


Sum(Orders, Coalesce(Price, 0))


This formula calculates the total price of all the orders. If the price of an item is not available, it uses 0 instead.

The Coalesce function is a powerful function that allows you to handle null or blank values in your data sources. It is a useful tool for Power Apps developers who work with data that may have null or blank values. By following the steps outlined in this article, you can easily use the Coalesce function in your Power Apps.

Power Apps Training Courses by G Com Solutions (0800 998 9248)