How To Calculate Sum Of The Number Using Power Automate

Introduction

This article will discuss how to sum up 4 lookup fields in a SharePoint list and add the result in a new column using Power Automate (previously known as Microsoft Flow).

Step 1

Create a SharePoint list called "Lookup List" that contains 4 lookup fields named L-A, L-B, L-C, and L-D, and a "Result" column where we will get the sum.

Step 2

Create a new flow in Power Automate and select the SharePoint trigger you want to use, such as "When an item is created or modified."

How To Calculate Sum Of The Number Using Power Automate

Add the "Get item" action and specify the site address and list name.

How to calculate sum of the number using Power Automate

Add a "Compose" action and enter the formula to sum the lookup fields. For example, the formula for summing the fields L-A, L-B, L-C, and L-D would be:

How to calculate sum of the number using Power Automate

add(add(add(int(triggerOutputs()?['body/L_x002d_A/Value']),int(triggerOutputs()?['body/L_x002d_B/Value'])),int(triggerOutputs()?['body/L_x002d_C/Value'])),int(triggerOutputs()?['body/L_x002d_D/Value']))

This formula retrieves the values of the lookup fields using the "Get item" action and adds them together using the "add" function. The "int" function is unnecessary as the lookup values are already integers.

Add the "Update item" action and specify the site address, list name, and item ID you want to update.

How To Calculate Sum Of The Number Using Power Automate

In the "Update item" action, map the "Result" column to the output of the "Compose" action.

Save and test the flow.

When a new item is created or modified in the list, the flow will retrieve the values of the lookup fields, sum them up, and update the "Result" column with the result.


Similar Articles