cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nohus
Helper I
Helper I

flow to count list elements on Sharepoint

Hi

 

I have posted this here before, but the suggestion I got for a solution doesn't work. I thought I would be able to find a solution using that as a template, but I failed.... Here's the problem:

 

I have been asked to create a Flow which can do more or less this:

 

I have two lists; "Total" and "In use".. The first list has two elements titled "squares" and "circles", and it has a column called "quantity". 

 

The second list tells us who has the squares and circles. So, a list element there may be; "Title: Square; User: John; Quantity: 3; Status: In use". The second list also lists the number of circles we have purchased ("Title; Square; User; 'empty'; Quantity: 40; Status: Purchased"). 

 

I want to create a flow which once per day counts how many squares and circles we have in stock and edits the quantity column on the first list accordingly. So, it adds all the purchased items and subtracts all the ones in use. 

 

There are, of course, alternative approaches to managing items. However, I cannot see how to create a flow which runs through an entire list neither do I see a way to do something akin to "circles = circles + total" for other approaches to the problem (like having a Flow edit the first list whenever the second list gets a new element). 

1 REPLY 1
v-yamao-msft
Community Support
Community Support

Hi @nohus,

 

Do you want to update the Total list with how many squares and circles in stock?

I have made the following flow, please check it for a reference. In my scenario, I am just going to update the quantity of circles, you could add a parallel branch to update the quantity of squares.

According to your description, create two lists Total and In use with required columns.

Initialize circles variables of type Integer, get items from In use list, add filter query action to filter out circles, then increment variables to get the total quantity of circles.

Than get items from list Total, filter out all the circles, and update the corresponding quantity with the output of Compose action.

Screenshots for your reference.

1.PNG2.PNG3.PNG

Please also check the following blog for a reference:

https://flow.microsoft.com/en-us/blog/calculate-running-totals-and-tracking-maximum-values-in-flow/

 

Best regards,

Mabel

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,794)