6 Use-Cases For The Power Apps App Formulas Property (Named Formulas)

6 Use-Cases For The Power Apps App Formulas Property (Named Formulas)

Power Apps named formulas enable us to use the same app logic in several different places. Unlike a variable, named formulas do not store values in memory. They recalculate each time they are referenced. Named formulas ensure the most current value is always available and up-to-date and their definition can only be managed in one-central location. In this article, I will explain the benefits of using Power Apps named formulas and show you the best ways to use them.

Table of Contents
1. Pre-Filtering SharePoint Lists
2. Gathering Extended User Profile Data
3. Checking Security Roles For The Current User
4. Obtaining URL Parameters And Setting Default Values
5. Making Simpler References To Environment Variables
6. App Theming Values (Colors & Fonts)

1. Pre-Filtering SharePoint Lists

Create a Power Apps named formula when a SharePoint list has a common set of filters used in many places. In the example below, the Service Vehicles SharePoint list has several trucks which are either active (in service) or inactive (not in service).

Service Vehicles SharePoint List:

1Service Truck 001No
2Service Truck 002Yes
3Service Truck 003No
4Service Truck 004Yes
5Service Truck 005Yes

Suppose we only the active vehicles to show in Power Apps. Therefore, we write a named formula in the App Formulas property like this:

fxServiceVehiclesActive = {
        'Service Vehicles',
        Active.Value = "Yes"

Now we can use our named formula in the app. Write fxServiceVehiclesActive in the Items property of a gallery and only these rows will appear.

2Service Truck 002Yes
4Service Truck 004Yes
5Service Truck 005Yes

2. Gathering Extended User Profile Data

Named formulas may be used to hold constants – a value that cannot be changed when the app is in play mode. User profile data for the current app user is an example of a constant.

We can use the Office365Users connector to get the full account details for an app user and reference it in a named formula. Whereas the User function only retrieves the account’s full name, email and image.

To do this, add the Office365Users connector to the app.

Then use these named formulas in the App Formulas property to prevent multiple calls to the Office365Users API. Once the function executes its result will be cached.

fxCurrentUser = Office365Users.MyProfile();
fxCurrentUserPhoto = If(

3. Checking Security Roles For The Current User

An app design might have require us to give a user with the custom security role ” Contoso Manager “security role access to a hidden screen. To get the security roles applied add these Dataverse Users and Security Roles tables to the app.

The write this code in the app Formulas property.

fxSecurityRoles = LookUp(
    domainname = User().Email
).'Security Roles (systemuserroles_association)'.Name;
fxIsUserManager = "Contoso Manager" in fxSecurityRoles.Name;

Let’s supposed the named formula fxSecurityRoles returns these values.

Basic User
Contoso Manager
Environment Maker

We can use the subsequent named formula fxIsUserManager to check if the current user is a manager. Since “Contoso Manager” was found in the user’s security roles the named formula returns true.


4. Obtaining URL Parameters And Setting Default Values

URL parameters can be passed into PowerApps and captured using the Param function. It is useful to store them in named formulas as constants because we can provide default values for when the parameter is missing.

Assume we wrote the following code in the Power Apps app Formulas property.

fxUrlParameter = {
    RecordId: Param("recordid"),
    LaunchSource: Coalesce(Param("launchsource"), "Unknown"),
    DebugMode: And(

Then we used this URL to access the app:


The named formula fxUrlParameter would return these values:

  • fxUrlParameters.RecordId =1
  • fxUrlParameters.LaunchSource = “Unknown”
  • fxUrlParameters.DebugMode = false

5. Making Simpler References To Environment Variables

Retrieving environment variables values is absurdly obtuse. We can use named formulas to abstract away the lengthy code needed to do it and use a much shorter reference instead.

Add the Dataverse tables called Environment Variable Definitions and Environment Variable Values to the app.

Then write this code in the App Formulas property.

fxEnvironmentVariable = {
    AdminEmail: LookUp(
        'Environment Variable Values',
        'Environment Variable Definition'.'Display Name' = "Admin Email"
    CompanyName: LookUp(
        'Environment Variable Values',
        'Environment Variable Definition'.'Display Name' = "Company Name"
    EnvironmentName: LookUp(
        'Environment Variable Values',
        'Environment Variable Definition'.'Display Name' = "Environment Name"

Now we are able to get the AdminEmail environment variable by simply typing


6. Configuring App Theming Values (Colors & Fonts)

Named formulas make referencing theming values more convenient because we can type a friendly-text name as opposed to a color code. The fxColor formula holds a set of colors to be used in the app while fxFont formula defines fonts and text sizes.

fxColor = {
    // Named Color Values
    Danger: ColorValue("#dc3545"),
    Info: ColorValue("#0dcaf0"),
    Primary: ColorValue("#0d6efd"),
    Secondary: ColorValue("#6c757d"),
    Success: ColorValue("#198754"),
    Warning: ColorValue("#ffc107"),

    // Default Colors Values
    Blue: ColorValue("#0d6efd"),
    Indigo: ColorValue("#6610f2"),
    Purple: ColorValue("#6f42c1"),
    Pink: ColorValue("#d63384"),
    Red: ColorValue("#dc3545"),
    Orange: ColorValue("#fd7e14"),
    Yellow: ColorValue("#ffc107"),
    Green: ColorValue("#198754"),
    Teal: ColorValue("#20c997"),
    Cyan: ColorValue("#0dcaf0"),
    White: ColorValue("#ffffff"),
    Grey: ColorValue("#6c757d"),
    GreyDark: ColorValue("#343a40"),

    // Grey-Shade Color Values
    Grey100: ColorValue("#f8f9fa"),
    Grey200: ColorValue("#e9ecef"),
    Grey300: ColorValue("#dee2e6"),
    Grey400: ColorValue("#ced4da"),
    Grey500: ColorValue("#adb5bd"),
    Grey600: ColorValue("#6c757d"),
    Grey700: ColorValue("495057"),
    Grey800: ColorValue("#343a40"),
    Grey900: ColorValue("#212529")

fxFont = {
    Heading: Font.'Lato Black',
    Body: Font.Lato,
    Size: {
        Body: 12,
        Subtitle: 14,
        Title: 16
    LineHeight: 1.5


If you have any questions or feedback about 6 Use-Cases For The PowerApps App Formulas Property (Named Formulas) please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Notify of

Inline Feedbacks
View all comments
Darren Neese
10 days ago

I love this.

Joe Krajnak
Joe Krajnak
10 days ago

I can see the usefulness of something like the filter expression but I don’t understand how most of the examples are different from just setting a variable in OnStart.

9 days ago

What’s the difference with the App’s Start property?

Ihno Hanuschka
Ihno Hanuschka
9 days ago

Great, thanks for this post, Matthew! I wasn’t aware of this before and it would have reduced complexity for my last project a lot πŸ˜‰
Just one question – is it possible to pass parameters so that formulas could be used as function? Didn’t find this in MS Learn… Best regards, Ihno

9 days ago

Hi Matthew,

In the intro you said “Unlike a variable, named formulas do not store values in memory. ” but in number two, you said “Once the function executes its result will be cached.”

Could you elaborate on this?


Jonathan Copin
Jonathan Copin
7 days ago

Personally I use it to create dynamic tabs on a form.
This allows me to use the new modern TabList control. I add a ” * ” to the end of the tab name if one of the displayed cards has an error (! IsBlank(cardName.Error) in Or() function) when submitted.
It is also possible to directly display the tab where there is an error by filtering on the first “*” in the items of the TabList.
I hope I have been clear πŸ˜…