Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Possible to use aggregate transformation to sum filtered CDS field values?

Within a flow, I am using the 'List Records' action. I have successfully applied an OData filter that only lists records with the appropriate project value. Is it possible to also apply an aggregate transformation to sum the numeric values of a field in the filtered items.

Community Support Team
Community Support Team

Re: Possible to use aggregate transformation to sum filtered CDS field values?

Yes, it is possible.

Within PowerApps, there is a Sum () function available to sum the special field within a table.

Sum( Table, NumericalFormula )

For example:


Sum(Sales, CostPerUnit * UnitsSold)

The label would show total sales by multiplying the values in those columns for each record and then adding the results from all records together:
Calculate total sales from units sold and cost per unit


Function reference.


If you would like to do it within Microsoft Flow, you need to take use of Variable and an Apply to each to sum the numeric field value within a table.

If here you prefer Microsoft Flow, then please try the steps below:

1. After the Get Items action, add two Variables, name them with SumField, another with Total,

2. Add an Apply to each, enter the Value of the Get Items action,

3. within Apply to each, add two Set Variable action, 

4. For the first Set Variable action, select SumField, with the value enter the following expression:

add(variables('Total'), items('Apply_to_each')?['ID'])

Here I take use of the SharePoint Get Items action ID field as an example.

5. with the second Set Variable action, select Total Value, enter the value field with:

Variable SumField.

6. Outside Apply to each, take use of the compose to check the Total Variable value.

Image reference:



Best regards,

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources


Power Apps Super User Class of 2020

Check it out!


Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,268)