Use Copilot to create and edit Power Fx formulas
Copilot is an AI feature in Power Apps Studio that helps you create and modify Power Fx formulas quickly. You can use Copilot in the formula bar to explain Power Fx formulas in natural language or generate Power Fx formulas from natural language or code comments.
Prerequisites
Copilot must be enabled for your environment and tenant. For more information, see Enable or disable Copilot (preview) in Power Apps.
Explain a formula
Use Copilot in the formula bar to understand what a formula is doing in plain language.
Select a control and its corresponding property. For example, a label control with its Text property.
On the formula bar, select the dropdown near the fx field label to see and choose Explain this formula.
Alternatively, you can select a subset of a formula and then select the dropdown near the fx field label and choose Explain this selection to explain only that part.
Copilot provides an explanation of the formula that you can copy and insert as a code comment or share with other makers who are working on the same app. When Copilot explains a selection, it might add context if that's important for the explanation.
Known limitations of explaining formulas
- The maximum length for a formula explanation is 5,000 characters. If the formula exceeds this limit, use a partial explanation to ensure it works.
- Copilot only recognizes default properties in Power Apps.
- Copilot doesn't recognize user-defined functions.
Note
AI generated content may be inaccurate and should be checked for accuracy.
Generate formulas from code comments
Copilot can generate Power Fx formulas from code comments in the formula bar. You can accept the suggestion or type the formula yourself. Formula code comments can also serve as documentation for your formulas, just like regular code comments.
With your canvas app open for editing, type a code comment using
//
or/*
in the formula bar.Wait a few seconds for Copilot to generate a formula suggestion or press
Enter
to generate it immediately.Press
Tab
on the keyboard to accept and use the suggested formula. You can also type through the suggestion.
The suggestion remains until you select elsewhere or type a character that doesn't match the suggestion.
You can keep the comments used for generating Power Fx formulas in the formula bar as documentation, similar to traditional code comments.
Note
- If Copilot doesn't provide a suggestion, then it couldn't generate a formula based on your comment. Try rephrasing the comment.
- We recommend enclosing in quotes the elements that you want to include in your formula, such as
"Button1.text"
.
Known limitations of generating formulas from code comments
- Copilot works on a singular control and property, and it doesn't make changes to other controls or properties to achieve the desired outcome.
- Copilot doesn't take existing formula text into account.
- Copilot only recognizes default properties in Power Apps.
- Copilot doesn't recognize user-defined functions.
- Code comments only work with general Power Fx functions, and not Power Apps-specific functions such as
Navigate()
. - The advanced panel doesn't trigger suggestions.
- Existing formulas for the property aren't included in the suggestion.
Create a formula (preview)
[This section is prerelease documentation and is subject to change.]
From the Copilot dropdown menu in the formula bar, you can now generate a formula using natural language to make a discrete request.
Note
The Copilot for formulas feature is turned on by default. To turn it off, you can find the setting with your app open. Go to Settings/Updates/Preview and find the Copilot for formulas toggle. Turning the setting off makes the Create a formula (preview) menu option disappear from the Copilot dropdown menu of the formula bar.
Use Copilot to create a formula from a discrete request
Select a control, like a Text label, and its corresponding property, such as Text.
On the formula bar, select the Copilot functionality menu > Create a formula.
In the Copilot text box, type your request, such as show today's day of the week.
Select the Create arrow to submit your request.
Copilot attempts to create a formula. Select Apply to insert the formula in the same position as the Copilot interface, or update and resumbit your request.
You see the result after you apply the formula.
Note
The same limitations apply for creating a formulas from a discrete request as generating formulas from code comments.
Responsible AI
Understand the choices you have when working with AI. Learn more in FAQ about using AI responsibly in Power Apps. Review the Power Fx Copilot FAQ for questions about this feature specifically.
Language Support
The following table lists the languages available for the formula bar copilot features, which is based on the settings in your Power Platform environment and browser.
Name | Language Code | Functionality Supported |
---|---|---|
English | en-US | Explain a formula, Comment generated formulas, Create a formula |
Chinese (simplified) - China | zh-Hans | Explain a formula, Comment generated formulas |
Czech - Czech Republic | cs-CZ | Explain a formula, Comment generated formulas |
Danish - Denmark | da-DK | Explain a formula, Comment generated formulas |
Dutch - Netherlands | nl-NL | Explain a formula, Comment generated formulas |
Finnish - Finland | fi-FI | Explain a formula, Comment generated formulas |
French - France | fr-FR | Explain a formula, Comment generated formulas |
German - Germany | de-DE | Explain a formula, Comment generated formulas |
Greek - Greece | el-GR | Explain a formula, Comment generated formulas |
Italian - Italy | it-IT | Explain a formula, Comment generated formulas |
Japanese - Japan | ja-JP | Explain a formula, Comment generated formulas |
Korean - Korea | ko-KR | Explain a formula, Comment generated formulas |
Norwegian (Bokmål) - Norway | nb-NO | Explain a formula, Comment generated formulas |
Polish - Poland | pl-PL | Explain a formula, Comment generated formulas |
Portuguese - Brazil | pt-BR | Explain a formula, Comment generated formulas |
Russian - Russia | ru-RU | Explain a formula, Comment generated formulas |
Spanish (Traditional Sort) - Spain | es-ES | Explain a formula, Comment generated formulas |
Swedish - Sweden | sv-SE | Explain a formula, Comment generated formulas |
Thai - Thailand | th-TH | Explain a formula, Comment generated formulas |
Turkish - Türkiye | tr-TR | Explain a formula, Comment generated formulas |