PowerApps Functions And Formulas | An Introduction

by | Power BI

In this tutorial, we’ll be learning about PowerApps functions and formulas. This gives us a good foundation in creating the rest of our Power App by ourselves.

We can use PowerApps functions and formulas to improve the functionality and change the behavior in our Power Apps canvas app.

PowerApps Functions And Formula Reference

Microsoft has an amazing resource in the documentation called Formula reference for Power apps.

PowerApps functions

This contains all the different formulas and functions that Power Apps has for us to do everything we needed to do. Those are all the things that we would put in this formula bar. For example, in this record, I concatenated the first name and last name together.

PowerApps functions

I used the Concatenate function for that.

PowerApps functions

We can also click it on the reference page to see exactly how it works. We’ll see what Concatenate does, the difference between Concatenate and the Concat function, and their corresponding syntax.

PowerApps functions

We’ll also see some examples which allow us to better understand how it works.

PowerApps functions

This reference is really useful especially if we want to try to do something we don’t know how to do. Let’s now go through an example.

Utilizing The Concatenate Function In PowerApps

In this example, let’s try to concatenate the DateJoined data to the Location data in this element.

PowerApps functions

To do that, we need to use this formula.

PowerApps functions

However, this formula won’t work and will produce an error.

PowerApps functions

That’s because the Concatenate function only accepts either a Text or a table column of Text type. In our formula, we referenced the Location record which is a text/string. But we also referenced the DateJoined record which is a date and not a text/string type.

PowerApps functions

So how do we turn a date into a text/string type?

Formatting Data Type Using The Text Function In PowerApps

Well, we need to use the Text function which converts any value and formats a number or date/time value to a string of text.

PowerApps functions

Let’s now add it to our formula. It doesn’t require an argument, but it still allows us to specify the format that we’d like the converted value to produce. For this example, let’s just use the ShortDate format. Moreover, let’s add a space to separate the location and the date.

PowerApps functions

As a result, we have the customer’s name, their location, and the date when they joined.

Configuring Dates Using The Month And Year PowerApps Functions

However, the date format is obviously too detailed. We probably only need the year and month. To display only the year and month, we need to use the Month and the Year functions separately.

Let’s now change our formula and use the Month and Year functions. Don’t forget to use the Text function again to convert the dates into strings.

Once we’re done with that, we’ll now see that the date only displays the month and year they joined.

Exploring Other PowerApps Functions In The Reference Material

Let’s try to check out other available functions in the Microsoft reference documentation.

1. The Refresh Function

First, let’s check out the refresh function that was used in this element.

Then, let’s see what refresh does.

As expected, this function retrieves a fresh copy of a data source. It needs a data source as an argument.

In this example, the data source is Table1.

2. The Today Function

Another thing that’s also really cool is the Today function. Instead of using the table name as the title, we can change it to the date today.

To do that, we’ll use the Today function in our formula.

Now it displays the date of recurrence today. If we’ll check out this app tomorrow, it’ll return the date for tomorrow and so on and so forth.

We can see a detailed explanation of this function in the reference material as well.

***** Related Links *****
Power Apps Fundamentals: Basic Functionality And Customization
Power Apps Environments: Setting Up The App Elements Properly
PowerApps Integration In Microsoft Power Automate

Conclusion

In a nutshell, it’s a good way to learn about these things when working with Power Apps. As I’ve mentioned, there’s a lot of different functions that we can use.

We can always check the reference material from Microsoft whenever we want to explore the functions and formulas. And I highly recommend that you go through all those functions because it makes knowing what to do and debugging easier.

All the best,

Henry

Related Posts

Comprehensive Data Analysis using Power BI and DAX

Data Model Discovery Library

An interactive web-based application to explore and understand various data model examples across multiple industries and business functions.