Skip to main content
Community site session details

Community site session details

Session Id : uw4alwBsJqABz8EiHAit9i
Power Automate - General Discussion
Unanswered

Flow to Sum Values on Sharepoint Based on Conditions

Like (0) ShareShare
ReportReport
Posted on 14 Aug 2023 14:46:27 by 2

I have seen previous examples of flows that add up all values based on a group in a sharepoint list and then deposit the sum into a column in a different sharepoint list, but I was wondering how I might build a flow when there are multiple conditions.  

 

To Illustrate, Here's the list I start with:

JJJJLow_0-1692023879173.png

And every time I update or add a row, I want the flow to update and sum up based on the conditions of name and activity. 

JJJJLow_1-1692023933578.png

In previous posts, the addition was only based on one condition such as name, but I was wondering if it would be possible to also include a choice column all in one flow, or I would have to do a new flow for each choice (which seems rather wasteful)

 

  • AgnieszkaPoland Profile Picture
    50 on 07 Mar 2024 at 14:03:39
    Re: Flow to Sum Values on Sharepoint Based on Conditions

    Hi @JJJJLow 

    Did you manage to find any solution? I have very similiar flow to build and looking for the solution for almost 2 weeks. Still not able to build any flow succesfully... will be grateful for any suggestions! 

     

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 15 Aug 2023 at 07:28:54
    Re: Flow to Sum Values on Sharepoint Based on Conditions

    For example, you can read the Data from one Sharepoint list every evening with a scheduled trigger and post the Output to another Sharepoint list.

  • JJJJLow Profile Picture
    2 on 14 Aug 2023 at 16:33:12
    Re: Flow to Sum Values on Sharepoint Based on Conditions

    Thank You. While this does work to get the desired output, my goal was to do this but also maintain two separate sharepoint lists.

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 14 Aug 2023 at 16:04:46
    Re: Flow to Sum Values on Sharepoint Based on Conditions

    Doing the addition is one select action:

    Chriddle_0-1692028804045.png

    With From:

     

    sort(
    	union(	
    		xpath(
    			xml(json(concat('{"root":{"item":', outputs('Data'),'}}'))),
    			'//Name/text()'
    		),
    		json('[]')
    	)
    )

     

     Name:

     

    item()

     

    Sleep:

     

    xpath(
    	xml(json(concat('{"root":{"item":', outputs('Data'),'}}'))),
    	concat('sum(//item[Name="', item(),'" and Activity="Sleep"]/Time)')
    )

     

    Other properties are the same (substituting the activity accordingly)

     

    Output:

     

    [
     {
     "Name": "Duke",
     "Sleep": 5,
     "Exercise": 0,
     "Eating": 4
     },
     {
     "Name": "Joe",
     "Sleep": 12,
     "Exercise": 16,
     "Eating": 0
     },
     {
     "Name": "Nancy",
     "Sleep": 0,
     "Exercise": 0,
     "Eating": 2
     }
    ]

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete