Average

How to Use the Power Fx AverageĀ  Function in Power Apps

One of the most commonly used functions in Power Fx is the Average function. The Average function is used to calculate the average of a set of values. In this article, we will show you how to use the Power Fx Average function in Power Apps.

How to Use the Average Function

To use the Average function in Power Apps, you will need to follow these steps:

1. Open Power Apps and create a new canvas app.

2. Add a data source to the app by clicking on the “Data sources” option in the left-hand menu.

3. Choose the data source that you want to use for your app.

4. Add a gallery to your app by clicking on the “Gallery” option in the left-hand menu.

5. Select the data source that you added in step 3.

6. Choose the type of gallery that you want to use (e.g., a vertical gallery).

7. Add a label to your gallery by clicking on the “Label” option in the left-hand menu.

8. Select the label that you added in step 7.

9. In the “Text” field of the label, enter the following formula:


Average(datasource,fieldname)


Replace “datasource” with the name of your data source and “fieldname” with the name of the field that you want to calculate the average for.

10. Save your changes and preview your app.

Examples

Here are some examples of how to use the Average function in Power Apps:

Example 1

Suppose you have a table called “Sales” that contains the following fields:

– Product

– Date

– Sales

To calculate the average sales for each product, you can follow these steps:

1. Create a new canvas app.

2. Add the “Sales” table as a data source.

3. Add a vertical gallery to your app and select the “Sales” data source.

4. Add a label to the gallery and enter the following formula in the “Text” field:


Average(Sales,Sales)


This will calculate the average of the “Sales” field for each record in the “Sales” table.

Example 2

Suppose you have a table called “Employees” that contains the following fields:

– Name

– Age

– Salary

To calculate the average salary of all employees, you can follow these steps:

1. Create a new canvas app.

2. Add the “Employees” table as a data source.

3. Add a label to your app and enter the following formula in the “Text” field:


Average(Employees,Salary)


This will calculate the average of the “Salary” field for all records in the “Employees” table.

The Average function is a powerful tool that can be used to quickly calculate the average of a set of values in Power Apps. By following the steps outlined in this article, you can easily incorporate the Average function into your apps and streamline your workflow.

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