LookUp

How to Use the Power Fx LookUp  Function in Power Apps

In this article, we will guide you through the process of using the Power Fx LookUp function in Power Apps. We will cover the basics of the function, as well as some of its more advanced features.

What is the Power Fx LookUp Function?

The Power Fx LookUp function is a powerful tool that allows you to search for specific values in a table and return related values. It can be used to perform a variety of tasks, including filtering data, finding values in a table, and performing calculations on data.

The syntax for the Power Fx LookUp function is as follows:


LookUp(Table, Formula)


The ‘Table’ parameter specifies the table you want to search in, while the ‘Formula’ parameter specifies the condition you want to search for. The formula can include operators, functions, and other variables to create a more complex search condition.

Basic Usage of the Power Fx LookUp Function

To use the Power Fx LookUp function, you must first have a table of data to search in. Let’s say we have a table called ‘Employees’ with the following columns:

– ID

– Name

– Department

– Salary

To search for a specific employee’s salary, we can use the following formula:


LookUp(Employees, ID = 123).Salary


This formula searches the ‘Employees’ table for the value ‘123’ in the ‘ID’ column. It then returns the value in the ‘Salary’ column for that employee.

Advanced Features of the Power Fx LookUp Function

The Power Fx LookUp function offers several advanced features that allow you to perform more complex searches and manipulations on your data. Let’s take a look at some of these features:

Searching for Multiple Values

To search for multiple values in a table, you can use the ‘In’ operator. For example, if we want to search for all employees in the ‘Sales’ and ‘Marketing’ departments, we can use the following formula:


LookUp(Employees, Department In ["Sales", "Marketing"])


This formula searches the ‘Employees’ table for all values in the ‘Department’ column that match either ‘Sales’ or ‘Marketing’.

Returning Multiple Values

The Power Fx LookUp function can also return multiple values at once using the ‘Concatenate’ function. For example, if we want to return the names of all employees in the ‘Sales’ department, we can use the following formula:


Concatenate(LookUp(Employees, Department = "Sales").Name, ", ")


This formula searches the ‘Employees’ table for all values in the ‘Department’ column that match ‘Sales’. It then returns the names of all employees in that department, separated by a comma.

Using Variables in Formulas

You can also use variables in your Power Fx LookUp formulas to make them more dynamic. For example, if we want to search for employees based on a value entered by the user, we can use the following formula:


LookUp(Employees, ID = TextInput1.Text)


This formula searches the ‘Employees’ table for the value entered by the user in a text input called ‘TextInput1’.

The Power Fx LookUp function is a powerful tool that can help you search for specific values in a table and return related values. By using some of its more advanced features, you can perform complex searches and manipulations on your data. We hope this article has been helpful in teaching you how to use the Power Fx LookUp function in Power Apps.

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