cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mmattar
Responsive Resident
Responsive Resident

Updating list with count

Hello all,

 

I have a dates sharepoint list with a column of count. Based on another list, where items get created i want to create a flow that updates my dates list count column based on the date the item was created.

 

Example: a item gets created for date 4/8/2019. A flow should trigger to see a item was created and then update the dates list for column                   date         count

                                                   4/8/2019  1

and if another one gets created on same date count goes to 2. 

 

Thank you all ! 

6 REPLIES 6
Piper
Resolver II
Resolver II

Hi @mmattar,

I'm not exactly sure where your question is in this post, it seems like you have set it up nicely already. If you are asking what the flow should look like I'll try to help.

 

  • Trigger - Creation of the SharePoint List Item
  • Action - Initialize Variable - Current Count, Integer
  • Action - Get Items (SharePoint) - this is where the important work happens in the Advanced Options
    • Filter Query: Filter on your date column matching your creation date - you will need to only match on the date portion of the creation date of the item
    • Top Count: 1 to ensure you only get one date record back
  • Action - Apply to Each the results of the Get Items - the loop should only execute once
    • Action - Set Variable Current Count equal to the Count column value (from the Get Items)
    • Action - Increment Variable Current Count by 1
    • Action - Update Item
      • Id: The same item you are working with in the loop
      • Count (column): Current Count

Here's some screen shots on how I would do it.

 

When SharePoint Item CreatedWhen SharePoint Item Created

Apply to EachApply to Each

 

Hope that helps,

Piper

Edit: Corrected Apply to Each image

Anonymous
Not applicable

@Piper What if the item being counted is a choice field? 

 

I'm trying to do the very same flow, but I need to allocate the count to the specific column, based on the choice.

 

To give some context, we are recruiting candidates for a job. For each candidate, we need to record the source of how we recruited them (radio, newspaper, job board, etc). There are about twenty different options and we want to count how many come from each source.

 

I tried working through your excellent instructions, but from this, I'm guessing I either need to set up a sharepoint list for each source, or a flow for each source.

@Anonymous

The complexity depends on what the list you are updating looks like. The example the original poster gave was a rows of dates with a count column.

 

Is yours rows of sources with a count column (narrow and deep) or is it a single row with 20 source count columns (wide and not deep)?

 

With that information I can better suggest a solution.

Thanks,

Piper

 

Anonymous
Not applicable

@Piper It is wide and not deep? lol...

 

I have one row for each date and 20 source count columns. I would provide a screen shot but I cannot even get it all in the frame to capture it. 

@Anonymous did you find a way for counting based on choice? Kindly share your approach if you did. I am stuck on a similar requirement.

@Anonymous

Question:

What if the update count is on other Count List when item is created?

Main Item submission list is different.

When an item is created, check if an item with similar Month/Year item exists on Created Count List: then

  • Add 1 to the Created Count Column on Count List. or Created New item if Count list does not contain Month/Year of Ticket created.

Item updated

  • For item "Completed", this Month add 1 to the Completed Count Column Value.

CreatedCount List.png

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (5,356)