Power Apps  

How to Use Copilot to create a formula from a discrete request in PowerApps

Introduction

Microsoft Power Apps makes it easy to build apps with minimal code. With Copilot, you can generate formulas simply by describing what you want in plain language. Instead of manually writing complex Power Fx expressions, you provide a clear, discrete request—and Copilot suggests the appropriate formula.

This guide explains how to effectively use Copilot to create formulas from specific, well-defined requests.

Open Copilot in Power Apps

  1. Open your app in Microsoft Power Apps Studio.

  2. Select the control (e.g., Gallery, Label, Button).

  3. Go to the formula bar.

  4. Click the Copilot icon.

  5. Type your request in natural language.

✅ Example Scenario

You have:

  • A SharePoint list called Employees

10
  • Columns: Name , Department , Salary , Status

1

You want to:

"Show only active employees from the IT department whose salary is greater than 5000."

Step : Use Copilot (Natural Language Request)

Inside Power Apps:

  1. Select your Gallery (e.g., Gallery1)

  2. In the Items property

  3. Click Copilot

  4. Type:

Filter Employees to show only active employees from IT department where salary is greater than 5000
1.5234

Copilot will generate something like:

Filter(
    Employees,
    Department = "IT" &&
    Status = "Active" &&
    Salary > 5000
)

You can then insert the formula directly.

5

🔹 Example 2: Conditional Color (UI Logic)

Scenario

In a gallery, you want:

"If Salary is greater than 10000 show green otherwise Red"

Copilot Prompt (Fill property)

If Salary is greater than 10000 make the color green otherwise red
7

Generated Formula

If(
    ThisItem.Budget > 10000,
    Color.Green,
    Color.Red
)
8

🔹 Other Example 1: Button to Submit Form + Show Notification

Scenario

When clicking Submit:

  • Submit form

  • Show success message

  • Navigate to HomeScreen

Copilot Prompt (OnSelect property)

Submit the form, show a success notification, and navigate to HomeScreen

Generated Formula

SubmitForm(Form1);
Notify("Record submitted successfully", NotificationType.Success);
Navigate(HomeScreen)

🔹 Example 2: Create Record Only If Not Exists

Scenario

Prevent duplicate email in Users list.

Copilot Prompt

If email does not already exist in Users list then create new record

Generated Formula

If(
    IsBlank(LookUp(Users, Email = TextInputEmail.Text)),
    Patch(
        Users,
        Defaults(Users),
        {
            Name: TextInputName.Text,
            Email: TextInputEmail.Text
        }
    ),
    Notify("Email already exists", NotificationType.Error)
)

🔹 Example 3: Role-Based Visibility (Real Business Case)

Scenario

Only show admin panel if logged-in user is Admin.

Copilot Prompt (Visible property)

Show this control only if logged in user's role is Admin

Generated Formula

LookUp(
    Users,
    Email = User().Email,
    Role
) = "Admin"

🔹 Example 4: Dashboard KPI Calculation

Scenario

Show total sales for current year.

Copilot Prompt (Label Text property)

Calculate total sales amount for current year

Generated Formula

Sum(
    Filter(
        Sales,
        Year(SaleDate) = Year(Today())
    ),
    Amount
)

Conclusion

Copilot in Microsoft Power Apps allows you to convert a clear, plain-language request into a functional formula. You describe what you need, Copilot generates the Power Fx formula, and you can review and refine it as needed. This makes building logic faster, easier, and more accessible, even for beginners.