Sum Function in PowerFx using Canvas App 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 Sum function calculates the sum of its arguments. The General syntax is Sum( NumericalFormula1, [ NumericalFormula2, ... ] ).

Reading this article, you can learn how to perform the Sum function from Power Fx using Microsoft Power Apps. Also, you will be able to learn Text box 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.

Canvas App

Create

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

PADPFSum

Step 3. To test the power function, First Rename the Screen name as SCRPAPF.

Tree view

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

Label control

Next, Insert a Label control and set the Name and Text property as LblLap and “Laptop Cost".

Laptop Cost

Next, Insert a TextBox control and set the Name and Format property as TxtLap and Number.

TxtLap

Next, Insert a Label control and set the Name and Text property as LblPrinter and “Printer Cost".

Printer Cost

Next, Insert a TextBox control and set the Name and Format property as TxtPrinter and Number.

Format properties

Next, Insert a Label control and set the Name and Text property as LblMouse and “Mouse Cost".

Mouse Cost

Next, Insert a TextBox control and set the Name and Format property as TxtMouse and Number.

TextBox control

Insert Button control and set the Name property as Calculate and Onselect property as UpdateContext({Lap:(TxtLap)}); UpdateContext({Prin:(TxtPrinter)}); UpdateContext({Mou:(TxtMouse)});.

UpdateContext

Insert Label control and set the Name property as LblRes and Text property as " "The total cost for Laptop, Printer, Mouse is"&Sum(Lap.Text, Prin. Text, Mou.Text) for displaying Results.

Insert Label

Finally, the form design looks like this.

Calculate

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

Power App

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

Browser

The Apple iPhone Display is.

 iPhone Display

The Tablet Display is.

Tablet Display

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


Similar Articles