web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to join items from...
Power Automate
Unanswered

How to join items from a sharepoint list and add their values?

(0) ShareShare
ReportReport
Posted on by 6

Mariagb20_0-1639492365917.png

I have two lists in sharepoint and I needthat based on the description and month they are grouped and the sum of their values ​​is performed, passing to the second list only one line with the description, month and value.
Note: I also need that before creating the items the flow check if there is already a line with the same description and month, if there is it will only give an item update on the value, if not it will create a new item, could you please help me ?

 

Categories:
I have the same question (0)
  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hi @Mariagb20 

    please checkout this flow:

    MarvinBangert_0-1639495323116.png

    My lists look like this:

    MarvinBangert_1-1639495390690.png

    MarvinBangert_2-1639495394757.png

    First you get all items from "List1", to get a better overview, you can also use the "Select" and "Parse JSON", overwise you can also leave them out and just work with the output of "get items".

    "Get items 2" Filter Query: 

    Title eq '@{items('Apply_to_each')['Title']}' and Month eq '@{items('Apply_to_each')['Month']}'

    Condition:

    length(outputs('Get_items_2')?['body/value']) is equal to 0

    Create item:

    Title: @{items('Apply_to_each')['Title']}
    Month: @items('Apply_to_each')['Month']
    Value: @{items('Apply_to_each')['Value']}

    Update item:

    Id: @{outputs('Get_items_2')?['body/value'][0]?['ID']}
    Title: @{items('Apply_to_each')['Title']}
    Month: @items('Apply_to_each')['Month']
    Value: @{add(outputs('Get_items_2')?['body/value'][0]?['Value'],items('Apply_to_each')['Value'])}

    the "Get items 2" will get all items from the List2 that meet the condition of "Title" and "Month" are equal to the item we are currently running on. So we would only get back 1 item, you need to write the code by yourself to work on the item at array position "0". To not only update the field "Value", we need to calculate the current value plus the value of the item we are currently running on.

     

    I could also think about another solution to first get all items from both lists, calculate everything within Power Automate and only write back the information into the List once, but didn't figured that out yet.

     

    Does this help you? Otherwise please give me some more information.

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

    Blog: Cloudkumpel

  • Mariagb20 Profile Picture
    6 on at

    @MarvinBangert what code did you use in the JSON step?

  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hey @Mariagb20 

    that code is the schema of the "Select" action, you can run your flow first, get the output of the action you want to have the Schema of, copy this (maybe even in some notepad on your desktop) and then use the "Generate from sample" button. This will just transform your JSON you received as an output to format it.

     

    Best regards

    Marvin

     

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

  • Mariagb20 Profile Picture
    6 on at

    Mariagb20_0-1639568389827.png

    @MarvinBangert 

    my flow is giving this error, do you know what it is? 

  • Mariagb20 Profile Picture
    6 on at

    Hello @MarvinBangert !!

     

    I applied the solution you suggested but the flow fails and shows this error, could you tell me how to solve it?

     

    Mariagb20_1-1640011290973.png

     

     

     

    My Flow :

    problem 1.png

     

    twotwothreethreeforfor

  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hi @Mariagb20 

    sorry for the delay! Could you please show me your add() function within your "Update Item"?

    Mine looks like this:

    add(outputs('Get_items_2')?['body/value'][0]?['Value'],items('Apply_to_each')['Value'])

     

    Does this help you? Otherwise please give me some more information.

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

    Blog: Cloudkumpel

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard