8 Various Power Apps Sum Column Examples

I have recently worked on the Power Apps Sum Column function, which allows you to sum a single column or multiple columns in the Power Apps.

In this Power Apps tutorial, I will explain the PowerApps Sum function and its syntax, providing an example.

Also, we will discuss the topics below:

  • Power Apps Sum Data table Column
  • Power Apps Add Sum Column
  • Power Apps Sum Filter
  • Power Apps Sum Column Values
  • Power Apps Sum Column in Collection
  • Power Apps Sum Gallery
  • Power Apps Max Function
  • Power Apps Sum IF
  • Sum a Gallery Column in Power Apps

Power Apps Sum Function | Sum Power Apps

PowerApps Sum function is a type of function that helps to calculate the sum of its arguments.

Power Apps Sum Function Syntaxes:

1. Sum( NumericalFormula1, [ NumericalFormula2, ... ] )

Where,

  • NumericalFormula(s) = You need to specify some numeric values that you want to perform the sum operation
2. Sum( Table, NumericalFormula )

Where,

  • Table = Specify the Data source on which you want to operate. The Data source may be a SharePoint Online List, Excel spreadsheet, or other format.
  • NumericalFormula = Here, you can specify the column of the table (Data source) that you want to perform with the sum operation

Power Apps Sum Example

Here, I will explain the Power Apps sum function with a simple example.

Example:

In Power Apps, there are two Text input controls for adding the “Employee Salary” and “Yearly Bonus“. Also, there is a Text label control for displaying the sum of two text input control values.

For that, select the Text label control and set its Text property to the code below:

Text = "Total Amount" & " : " & Sum(
    txt_Salary.Text,
    txt_Bonus.Text
)

Where,

  • txt_Salary, txt_Bonus = Power Apps text input control names
power apps sum

Once it is done, Save, Publish, and Preview the app. Once the user adds the text input values, the text label control will display today’s amount, as shown below.

Output:

powerapps sum text input

Power Apps Sum Data table Column

Next, I will show you how to work with the Power Apps sum data table column with a simple scenario.

Scenario:

I have a SharePoint Online list named “Product Details” and this list contains the below fields.

Column NameData Type
Product NameIt is a default single line of text
ManufacturerChoice
PriceNumber
QuantityNumber
QuantityIs AvailableYes/No
Purchase DateDate and time
powerapps sum table column

In Power Apps, there is a Data table control to display all the Sharepoint list records. Now, I would like to get the sum of the price column and display the result on the Text label control.

To do so, insert a Text label control under the data table control and set its Text property as:

Text = "Total Amount" & " : " & Sum(
    'Product Details',
    Price * Quantity
)

Where,

  • ‘Product Details’ = SharePoint Online list
  • Price, Quantity = SharePoint list number fields
power apps sum function

Also, you will get the Delegation warning [The highlighted part of this formula might not work correctly on large data sets. The “Sum” operation is not supported by this connector.]

powerapps sum column

To resolve this issue, create a collection using App’s OnStart property as:

OnStart = ClearCollect(
    colProducts,
    'Product Details'
);

Where,

  • colProducts = Power Apps collection name
sum function in powerapps

Now, select the Text label and Text property as:

Text = "Total Amount" & " : " & Sum(
    colProducts,
    Price * Quantity
)
sum in power apps

This way, you can work with the Power Apps sum Data table column.

Read this article to know more: Sum Column in Power Apps Data Table

Power Apps Add Sum Column

In this example, I will show you how to add a Sum column in the Data table. To do so, select the Data table control and set its Items property as:

Items = AddColumns(
    colProducts,
    TotalPrice,
    Price * Quantity
)

Where,

  • TotalPrice = New column name
sumif power apps

To add a created sum column, click on the Field option, select the + Add field to choose a field, and select the Add button, as shown below.

powerapps sum column values

Have a look at the screenshot below for the output.

powerapps sum function

Power Apps Sum Filter

In this section, I will explain how to use the Power Apps Sum filter with a simple example.

Example:

In Power Apps, there is a Date picker control to select the date under the data table, and a Text label displays the result [Sum of the selected date price column values].

To do so, insert the Text label control and set its Text property as:

Text = "Total Amount" & " : " & Sum(
    Filter(
        colProducts,
        'Purchase Date' = dte_PurchaseDate.SelectedDate
    ),
    Price
)

Where,

  • ‘Purchase Date’ = SharePoint list date and time field
  • dte_PurchaseDate = Power Apps date picker control
powerapps sum filter

Now, Preview the app. Once the user selects the respective date from the date picker control, the text label displays the result, as shown below.

power apps sum filter

Power Apps Sum Column Values

Suppose you want to get the sum of the SharePoint column values using the Combo box control and display the result on the Text label control. To achieve it, on the Power Apps Screen, insert a Combo box control and set its Items property as:

Items = 'Product Details'.Title

Where,

  • Title = SharePoint list text field
power apps sum column values

Now, insert a Text label control and set its Text property to the code below.

Text = "Total Amount" & " : " & Sum(
    Filter(
        colProducts,
        Title in cmb_Items.SelectedItems
    ),
    Price
)

Where,

  • cmb_Items = Power Apps combo box control name
powerapps sum column value

Finally, Preview the app. Once the user selects multiple columns from the combo box control, the text label displays the sum of the selected price column values, as shown below.

Output:

powerapps sum collection

This is how we can work with the Power Apps sum column values.

Power Apps Sum Column in Collection

In this section, I will show you how to work with the Power Apps sum column in the collection using a simple scenario.

Scenario:

I have created a Power Apps collection named “colEmployee” with the following fields [EmployeeID, Name, Salary]. Follow the code below to create a collection.

ClearCollect(
    ColEmployee,
    {
        EmployeeID: "SP001",
        Name: "Lynee",
        Salary: 3500
    },
    {
        EmployeeID: "SP002",
        Name: "Jane Smith",
        Salary: 4500
    },
    {
        EmployeeID: "SP003",
        Name: "Michael Johnson",
        Salary: 5000
    },
    {
        EmployeeID: "SP003",
        Name: "Johanna",
        Salary: 3000
    }
)

Input:

powerapps sum column in collection

Now, I would like to get the sum value of the collection filed [Salary]. For that, insert the Text label and set its Text property as:

Text = "Total Salary Amount" & " : " & Sum(
    ColEmployee,
    Salary
)

Where,

  • ColEmployee = Power Apps collection name

This way, we can work with the Power Apps sum column in the collection.

powerapps sum collection column

Power Apps Sum Gallery

Next, I will show you how to get the sum value of the Power Apps gallery column. To work around this, insert a Gallery control on the Power Apps Screen and set its Items property as:

Items = ColEmployee
power apps gallery sum

Now, insert a Text label control and set its Text property to the code below.

Text = "Total Salary Amount" & " : " & Sum(
    gal_Items.AllItems,
    Salary
)

Where,

  • gal_Items = Power Apps gallery control
powerapps gallery sum

Power Apps Max Function

Suppose you want to get the maximum value of the collection column [Salary]. Insert a Text label control and set its Text property to the code below.

Text = "Max Salary Amount" & " : " & Max(
    ColEmployee,
    Salary
)
powerapps max sum value

This is how we can work with the Power Apps Max function.

Power Apps Sum IF

In the last, I will show you how to use Power Apps sum or how to filter the Power Apps sum using a simple example.

Example:

In Power Apps, there is a Data table control, a Combo box control, and a Text label control. Now, I would like to get the sum of the Price column using the filter condition based on the SharePoint choice field.

To do so, insert the Combo box control and set its Items property to the code below.

Items = Distinct(
    'Product Details',
    Manufacturer.Value
)
power apps sum if

Now, select the Text label control and set its Text property as:

Text = "Total Price" & " : " & Sum(
    Filter(
        colProducts,
        Manufacturer.Value in cmb_Records.Selected.Value
    ),
    Price
)

Where,

  • Manufacturer.Value = SharePoint choice field value
  • cmb_Records = Power Apps combo box control name
  • Price = SharePoint number filed
powerapps sum if

Finally, Preview the app. When the user selects any value from the combo box control, the text label displays the selected value price, as shown below.

Output:

powerapps sum conditions

This way, you can work with the Power Apps Sum IF or Power Apps Sum condition.

Sum a Gallery Column in Power Apps

Suppose you have a Power Apps gallery with many number fields. You want to sum a specific column from the gallery and display the total calculated value/result in a Label control.

Example:

Below is a Power Apps repeating table [Gallery] with various records [Product Name, Quantity, Price, etc.]. I want to calculate the sum of the Product Quantity, Product Price, and Quantity*Price columns from the gallery. Also, the calculated result will be displayed in a label as shown below.

How to Sum a Gallery Column

Insert three Text label controls for Product Quantity, Product Price, and Quantity*Price.

  • Select the Product Quantity label and set its Text property as:
Text = Sum(galRepeatRows.AllItems, Value(txtProdQuantity.Text))
  1. galRepeatRows = Gallery Control Name
  2. txtProdQuantity = Text input control name for the Product quantity

As the text input is a number field, we must convert the text value to a number using the Power Apps Value() function.

Sum a Gallery Column
  • Similarly, follow the code below to calculate the sum of Product Price and Total (Quantity*Price) values.
Text = Sum(galRepeatRows.AllItems, Value(txtProdPrice.Text))             // For Product Price
Text = Sum(galRepeatRows.AllItems, Value(txtTotal.Text))                     // For Qunatity*Price
  1. txtProdPrice = Text input control name for the Product price
  2. txtTotal = Text input control name for the Quantity & Price

This is how to sum a gallery column in Power Apps.

Some more articles you may also like:

In this Microsoft Power Apps tutorial, we learned the Power Apps sum data table column, the Power Apps Add sum column, and the Power Apps sum filter.

We also covered the Power Apps sum column values, the Power Apps sum column in the collection, and the Power Apps sum gallery.

  • The only Sum() function I get doesn’t allow have the second format, with a datasource parameter. Where/how does one get that override of the function?

  • >