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 what the PowerApps Sum function is and its syntax, Power Apps Sum function example.

Also, by taking some simple scenarios, I 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

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” and 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.

See also  Create a canvas app in PowerApps from a SharePoint list (Helpful tutorial)

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].

See also  Power Apps Modern Toggle Control - How to Use

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.

See also  Power Apps Radio Button [How to Use]

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.

Some more articles you may also like:

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

Also, we covered the Power Apps sum column values, Power Apps sum column in the collection, and Power Apps sum gallery.

  • >