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 / Copy Max value of prev...
Power Automate
Unanswered

Copy Max value of previous sharepoint list rows.

(0) ShareShare
ReportReport
Posted on by 31

I have a list that when I create new, I want to take the highest number in the "Calc Test" column from previous entries and update the current title with that value.  I can not reference "last id" because I deleted items so the ID numbers are spaced out.

 

rcwhite_0-1675738463707.png

 

Categories:
I have the same question (0)
  • Verified answer
    v-chengfen-msft Profile Picture
    on at

    Hi @rcwhite ,

    Please try to use 【Get items】to get the highest number in the "Calc Test" column.   

    I made a template for your reference:

    vchengfenmsft_0-1675739796974.png

    Here is flow:

    vchengfenmsft_1-1675740337051.png

    vchengfenmsft_2-1675740363564.png

    Here is result:

     

    vchengfenmsft_1-1675740056547.png

    vchengfenmsft_0-1675740262307.png

    Best Regards,

    ChengFeng

  • Verified answer
    rcwhite Profile Picture
    31 on at

    @v-chengfen-msft  thanks, I am getting an error that "calctest" does not exist. Should I spell it exactly how it is shown in my list?

     

    rcwhite_2-1675741268782.png

     

    rcwhite_1-1675741129507.png

     

     

  • v-chengfen-msft Profile Picture
    on at

    HI @rcwhite 

    Has calctest ever been renamed?

    Please try the following method to get the real name of the column

    vchengfenmsft_0-1675741417207.pngvchengfenmsft_1-1675741464578.png

     

    Best Regards,

    ChengFeng

  • rcwhite Profile Picture
    31 on at

    Name is 

    rcwhite_0-1675742710198.png

     

  • rcwhite Profile Picture
    31 on at

    @v-chengfen-msft I can not use that column to filter since it is a calculated column. 

     

    I got it to work by ORDERBY Title desc, then put the calc test field in my TITLE in Update Item. 

     

    Thanks for your help!

  • grantjenkins Profile Picture
    11,063 Moderator on at

    For this scenario, you don't need the extra calc column. You can just get the previous Title value and add 1 to it.

     

    For this example, I'm using the following list.

    grantjenkins_0-1675747300231.png

     

    You don't need to do the next step, but it will allow you to not have to enter a value for the Title (required field) of the new item each time. I've set the default value for Title to "Pending". To do this, go into the List settings, click on the Title field, and set the default value.

    grantjenkins_1-1675747769841.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_2-1675747821010.png

     

    When an item is created is your trigger that you already have.

    grantjenkins_3-1675749296015.png

     

    Get items retrieves items from the list. It has a filter to exclude the current item, sorts by Title in descending order, and is set to only return a single item. The item returned will contain the Title that we want to add 1 to for our new item.

    grantjenkins_5-1675750388183.png

     

    Update item updates the item's Title using the ID from the Trigger and uses the following expression to add 1 to the previous Title.

     

    //Convert the Title to an integer and add 1 to it.
    
    add(int(first(outputs('Get_items')?['body/value'])?['Title']), 1)

     

    grantjenkins_6-1675750694907.png

     

     

    If you wanted to add some styling to your list while it's still generating the new Title, you can add some Column formatting as shown below. Note that this assumes you set the default value for Title to "Pending".

    grantjenkins_8-1675754495404.png

     

    grantjenkins_9-1675754502815.png

     

    While the new Title is being generated.

    grantjenkins_12-1675754650048.png

     

    After the new Title has been generated.

    grantjenkins_11-1675754555902.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard