cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Support
Community Support

Re: flow to count list elements on Sharepoint

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
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,997)