Calculate Sum of Numbers Using Power Automate
Calculate Sum of Numbers Using Power Automate
Power Automate provides powerful capabilities for processing data and performing calculations within workflows. One common requirement is calculating the sum of multiple numbers, such as invoice amounts, expenses, sales values, order totals, or other business metrics.
Using variables and expressions, Power Automate can automatically calculate totals and generate accurate results without manual intervention.
Business Scenario
Suppose a SharePoint list contains multiple expense records. At the end of the workflow, you need to calculate the total expense amount and send the result in an approval email.
Step 1: Initialize Variable
Name : TotalAmount Type : Float Value : 0
The variable will store the running total.
Step 2: Apply to Each Record
Loop through the records returned from SharePoint, Excel, Dataverse, or any other data source.
Step 3: Increment Variable
add(
variables('TotalAmount'),
items('Apply_to_each')?['Amount']
)
This expression adds the current record amount to the running total.
Example
| Record | Amount |
|---|---|
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
Final Total = 600
Using Compose Action
variables('TotalAmount')
Use Compose to display the calculated total value.
Common Use Cases
- Invoice total calculation
- Expense management
- Order value calculation
- Sales reporting
- Payroll processing
- Financial approvals
Benefits
- Automates calculations
- Eliminates manual errors
- Improves reporting accuracy
- Supports financial workflows
- Enhances business automation
Key Takeaways
- Initialize a numeric variable to store totals.
- Use Apply to Each for record processing.
- Use add() expression to calculate running totals.
- Suitable for invoices, expenses, and reporting.
- Improves workflow automation efficiency.