Skip to main content

Notifications

Community site session details

Community site session details

Session Id : vInNhHRDnnm7bKy7F8o7xA
Power Automate - Building Flows
Answered

Copy Sum with name to other SharePoint list

Like (0) ShareShare
ReportReport
Posted on 28 Dec 2022 14:04:32 by 7

Dear All,

 

I have 2 SP list  (List 1 and List 2)

- List 1 is detail item with Name + Quantity

 

I want to make flow that can copy sum Data of each items from list 1 to list 2

List 1

 

hainguyen_0-1672236090229.png

hainguyen_0-1672236424007.png

 

 

List 2

 

hainguyen_1-1672236227032.png

 

 

 

 

  • hainguyen Profile Picture
    7 on 30 Dec 2022 at 07:33:34
    Re: Copy Sum with name to other SharePoint list

    Thank for your detail explanation and support. I really appreciate your help. 

    One again, Thank you very much. !!! and Happy New Year.!!!!

  • Verified answer
    Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on 28 Dec 2022 at 18:06:23
    Re: Copy Sum with name to other SharePoint list

    Hi @hainguyen 

    Please follow This as per your requirement.

    1. Use Get Items Action and get all the items from list 1

    Amit_Sharma_0-1672249250813.png

     

    2. Use One Select Action and Select Only Name From get Items Action.

    Amit_Sharma_1-1672249336915.png

     

    3. Use one Compose Action and perform union on body which return by select Action.

    Amit_Sharma_2-1672249411027.png

    union(body('Select'),body('Select'))

     

    4. Then use one Apply to each Action and provide value which return by union.

    Amit_Sharma_3-1672249495879.png

     

    5. In apply to each Action use one filter Action and filter list 1 according to Name (which is current value of apply to each).

    Amit_Sharma_4-1672249635305.png

    Amit_Sharma_5-1672249671788.png

    items('Apply_to_each')?['Name']

     

    6. Then use one compose Action rename to JSON and provide expression.

    Amit_Sharma_6-1672249771428.png

     

    {
     "root": {
     "Numbers": @{body('Filter_array')}
     }
    }

     

     

    7. Then Use one another compose Action rename to SUM and provide expression.

    Amit_Sharma_7-1672249892024.png

     

    xpath(xml(outputs('JSON')), 'sum(/root/Numbers/SL)')

     

    Note: In expression SL is a column name of List 1

     

    8. Use Get item action and list items from List 2 according to filter query.

    Amit_Sharma_8-1672250084875.png

     

    Note: In filter query name also enclose with single quotes.

    items('Apply_to_each')?['Name']

     

    9. Then Use one condition Action.

    Amit_Sharma_9-1672250259245.png

    empty(outputs('Get_items_From_List_2')?['body/value'])

     

    10. create or update list 2 according to condition output.

    Amit_Sharma_10-1672250374343.pngAmit_Sharma_11-1672250425615.pngAmit_Sharma_12-1672250471333.png

    Amit_Sharma_13-1672250506789.png

     

    In Update item Action

     

    Id: 

    outputs('Get_items_From_List_2')?['body/value']?[0]?['ID']

    Title:

    outputs('Get_items_From_List_2')?['body/value']?[0]?['Title']

    Name:

    outputs('Get_items_From_List_2')?['body/value']?[0]?['Name']

     

    Total:

    Amit_Sharma_14-1672250655584.png

     

    Complete Flow

    Amit_Sharma_15-1672250715978.png

     

     

    SPL List1:

    Amit_Sharma_16-1672250743436.png

     

    SPL List2:

    Amit_Sharma_17-1672250767013.png

     

    Hope it helps!

     

     

     

  • hainguyen Profile Picture
    7 on 28 Dec 2022 at 15:30:19
    Re: Copy Sum with name to other SharePoint list

    Hi @Amit_Sharma ,

     

    I follow your instruction, however, what i need i Copy and update Sum data in List 2. 

    your flow it's only copy. Could you please help me to get update if list 1 add more items.

    hainguyen_0-1672241406951.png

     

  • Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on 28 Dec 2022 at 14:58:21
    Re: Copy Sum with name to other SharePoint list

    Hi @hainguyen 

    When I Post My Reply, I don't Know How All Thing Collide with each other?

    Please Wait I will recreate For You

     

  • Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on 28 Dec 2022 at 14:50:54
    Re: Copy Sum with name to other SharePoint list

    Hi @hainguyen 

     

     I have created sample for you

    1. Get All Item from First List

     

    2.

    union(body('Select'),body('Select')) 

    3.

    Use One Filter Array Action

    items('Apply_to_each')?['Name']Name is Column name here

     

    4. Use one compose Action rename to JSON and put value.

    5. Use another compose action Rename to Sum and put Expression.

    xpath(xml(outputs('JSON')), 'sum(/root/Numbers/Quantity)') 

    Quantity Is column name in expression of first List

     

    6. Use create item Action and pass value.

    items('Apply_to_each')?['Name'] 

     

     

    --------------------------------------------------------------------
    If I have answered your question, please mark post as Solved.
    If you like my response, please give it a Thumbs Up.

     

     

    Amit_Sharma_8-1672238944719.png

    Amit_Sharma_7-1672238731720.png

    Amit_Sharma_6-1672238619646.png

    Amit_Sharma_4-1672238461182.png

    Amit_Sharma_3-1672238389209.png

    Amit_Sharma_2-1672238350429.png

    Amit_Sharma_0-1672238245725.png

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started