Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

Flow: Update Total Item Cost from 2 different lists

Hello everyone!


I have 2 lists in SharePoint one called "Sales Invoices" and "Sales Data".


Sales Invoices consist of the following columns:
(Invoice ID,Invoice Name,Total Invoice Cost).


Sales Data consist of:
(Invoice Items ID:is lookup from Sales Invoices, to get information from Invoice ID in Sales Data) Item Name,Quantity,and Cost.

What i want to achieve is the following:
Each Invoice contain multiple items with different costs.
I want to get the Sum Cost of the Invoice ID from Sales Data and Update the Total Invoice Cost in Sales Invoices.

I have created a flow but only get the item cost,while i need to get Total Invoice Cost here are screenshots:
I have 2 items in Sales data for the same invoice id, the total cost should be 65$ for both items, so it should update in "Sales Invoices list" the Total Invoice Cost to 65$.


Flow screenshot:



What will be the flow to achieve the scenario mentioned above,even when i update any items cost  ?


Any help will be greatly appreciated.


Thank you!

Community Support
Community Support

Hi @Julien2,


You can initialize a integer variable and set its default value to 0, then Get items of the Sales Date list, use the Increment variable action to sub these cost, you can get these cost by enter the expression item()?['Cost'], after the loop through the integer variable will be total cost, put the variable into the Update item action:

Annotation 2019-12-12 140007.png


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

Hi @v-litu-msft ,


I have followed the steps you mentioned but as flow result here is what i get:


Also i have tried instead of using Set Variable, i have added a compose action using this expression:




But also the flow fails without updating the Total Invoice Cost column.

I will recap what i want to achieve:
Here the Invoice Items ID 3 has a total sum of 280$, i want to update this number in the Sales Invoices list for Invoice ID 3.


Thanks in advance!

Hi @v-litu-msft ,
Any suggestions ?

Hi @Julien2,


There is increment variable action in the Apply to each action, not set variable action.

And the field in the set variable should be a integer, please make sure the Cost field has value and its format is integer.


If you want to get the result you want, I think there is no a easy way to do in Flow, it might be a complicated Flow.


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

Hi @v-litu-msft ,

Good point i didn't know that there is an increment variable action. Now after i have modified the flow, it ran successfully.But as result i didn't achieve the right results.

Here are the Total amount of Invoice ID's 4 and 5: where Invoice 4 = 50$ and Invoice 5 = 50$:

Sales Data.PNG

In the Sales Invoices list here are the results:


It count the rows and update the Total Invoice Cost to the row counted. While it should trigger the other list Invoices ID's amount and update the right total invoice cost amount result for each invoice id.

Here is the flow result:


If there is no easy way to do it in Flow, what would be this complicated flow to achieve it ?


Looking to hear from you. Thanks for your support!

Hi @v-litu-msft ,

Any news ?

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,447)