cancel
Showing results for
Did you mean:  Helper II

## Sum of Multiplicated Columns

Hi All,

I have a small requirement which i would like to achieve through PowerAutomate.

Data source is SharePoint.

So currently I have 4 Columns Quantity , Supplier 1 , Supplier 2 , Supplier 3 and all of them are of type number. Now what i would like to achieve is to multiply Quantity * Supplier 1  , Quantity * Supplier 2 , Quantity * Supplier 3 and then Sum of (Quantity * Supplier 1) , Sum of ( Quantity * Supplier 2 ) , Sum of ( Quantity * Supplier 3 ).
Now it can be a case where in Supplier 1 , Supplier 2 , Supplier 3  values can be multiple.
Example

 Quantity Supplier 1 Supplier 2 Supplier 3 20 10 20 30 10 20 10 20

Now what i would like to achieve is the final output marked in bold :

Sum of ( Quantity * Supplier 1 )  = 400

Sum of ( Quantity * Supplier 2 )  = 500

Sum of ( Quantity * Supplier 3 )  = 800

How can I achieve this? Would appreciate any help!

1 ACCEPTED SOLUTION

Accepted Solutions  Community Champion

I'm not sure I understand the question.

The three variables used in the flow will store the Quantity * Supplier totals. You can use the variables at the end of the flow, after the Apply to each loop has completed. I have added a SumAll variable: The new output is: The updated flow actions are:  The Sum All variable and the message in the compose action: These are the details of the actions, which I added to the end  of the flow: ``add(add(variables('varSumSupplier1'),variables('varSumSupplier2')),variables('varSumSupplier3'))``

You have access to the values stored in the variables using Dynamic content: Ellis
____________________________________
If you like my response, please give it a Thumbs Up.

3 REPLIES 3  Community Champion

Here is one method you could use. Based on the following demo SharePoint List: we can produce the following message: using this flow: Here is the flow showing more details:    The expressions used above are shown here: Hope this helps.

Ellis

____________________________________
If you like my response, please give it a Thumbs Up.  Helper II

@ekarim2020 Thank you for the reply and solution.
I applied your solution and i am getting the multiplied values but at the end of it i would want to sum all Suplier1 values , Supplier 2 Values and Supplier 3 Values separately in different variables so that i can use it in further flows.
Currently i am getting the multiplied values in applied to each for 3 different items i want to sum those 3 values. How can i do this?     Community Champion

I'm not sure I understand the question.

The three variables used in the flow will store the Quantity * Supplier totals. You can use the variables at the end of the flow, after the Apply to each loop has completed. I have added a SumAll variable: The new output is: The updated flow actions are:  The Sum All variable and the message in the compose action: These are the details of the actions, which I added to the end  of the flow: ``add(add(variables('varSumSupplier1'),variables('varSumSupplier2')),variables('varSumSupplier3'))``

You have access to the values stored in the variables using Dynamic content: Ellis
____________________________________
If you like my response, please give it a Thumbs Up.   