Average Function in Canvas App using PowerFx with Power Apps

Power Apps is a suite of apps, services, connectors, and data platforms that provide a rapid application development environment to build custom apps for your business needs. More Details: https://docs.microsoft.com/en-us/powerapps/powerapps-overview.

Power Fx is the low-code language that will be used across the Microsoft Power Platform. It's a general-purpose, strong-typed, declarative, and functional programming language.

The Average function calculates the average, or arithmetic mean, of its arguments. The General syntax is Average( Table, NumericalFormula)

Reading this article, you can learn how to perform the Average function from Power Fx using Microsoft Power Apps. Also, you will be able to learn Slider control and Label control in the Power Apps environment.

Step 1. Open the URL https://powerapps.microsoft.com/en-us/ in the browser for Power apps.

Create an account with your Organisation Mail ID and log in after logging into your Power Apps account.

Step 2. First, Click Create (+ ) and Select the Canvas app from blank.

Power Apps

Create blank app

Create

Next, give the app name as PAPFAverage and format it as Tablet.

Canvas app from blank

Step 3. To test the power function, first rename the Screen name as SCRPAPF.

Power function

Next, Insert a Label control and set the Name and Text property as LblTitle and “Average function in canvas App using PowerFx with Power apps”.

Text label

Next, Insert a Label control and set the Name and Text property as LblM1 and “Maths"

Maths power app function

Next, insert a Slider control and set the Name and Default property as SldMaths and 50.

Set the name

Next, Insert a Label control and set the Name and Text property as LblPhy and “Physics"

Physics

Next, insert a slider control and set the Name and Default property as SldPhy and 50.

Set the name and default property

Next, Insert a Label control and set the Name and Text property as LblChem and “Chemistry"

Chemistry

Next, insert a Slider control and set the Name and Default property as SldChem and 50.

Insert a slider

Insert Label control and set the Name property as LblRes and Text property as "The Average of Maths, Physics, Chemistry is "& Average(SldMaths.Value,SldPhy.Value,SldChem.Value) for displaying Results.

Text label

Finally, the form design looks like this.

Design

Step 4. Now we can see the preview of your App in Power Apps Studio, and The output of the PAPFAverage is.

Power apps Studio

After Changing the Marks in the slider control, The Browser Display is.

Browser display

The Apple iPhone Display is.

Apple iphone display

The Tablet Display is.

Tablet display

Summary

Now, you have successfully tested the Power Fx – Average function in the Power Apps Studio environment.


Similar Articles