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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Setup the Total settin...
Power Automate
Answered

Setup the Total settings in a list view

(0) ShareShare
ReportReport
Posted on by 43

Hi,

 

I copied an existing list via power automate and was able to do so. However, some settings like the Total of a column wasn't copied together with the list. Can you teach me on how to do this using power automate? I'd like to set the Totals after creating the list through Power Automate.

 

Thank you in advance!

Categories:
  • Verified answer
    Expiscornovus Profile Picture
    33,997 Most Valuable Professional on at

    Hi @Ninijca,

     

    Totals is something you configure for a specific field in a view. Which type of total do you want to use, SUM? (or Count, Average, Maximum, Minimum, Std Deviation or Variance?) You can use an aggregations element to set such a total.

     

    You can use a Send an HTTP request to SharePoint to create a new view and set the totals on a field via the SP.View.aggregations property.


    Below is an example

    This example creates a new view with the aggregation on an existing column called Cost.

     

    URI

     

    _api/web/lists/getbytitle('@{variables('ListName')}')/Views

     

     

    Headers

     

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

     

    Body

     

    { 
    "__metadata": { "type": "SP.View" }, 
    "Title": "Total SUM of Cost - SP.View Method",
    "Aggregations": "<FieldRef Name=\"Cost\" Type=\"SUM\"/>",
    "PersonalView": false
    }

     

     

    createnewview_aggregations.png

     

    2. Test result.

     

    totalcost_sum.png

  • Verified answer
    sandeepstw Profile Picture
    312 Moderator on at

    1. Start with creating a new automation flow in Power Automate. Choose the appropriate trigger. If you're doing it manually, select 'Manually trigger a flow'.

    2. To copy the list data, add a "Get items" action for SharePoint. Specify the Site Address and List Name of the source list.

    3. Next, add a "Create item" action for SharePoint. Set the Site Address and List Name to the destination list.

    4. Within the "Create item" action, map the fields of the source list to the new list.

    5. After successfully copying the list, we'll have to update the Totals of a column. As of my knowledge cutoff in September 2021, Power Automate does not directly support updating list view settings, which includes setting column totals.

    6. However, you can do this using a "Send an HTTP request to SharePoint" action to call the SharePoint REST API. This action can be used to make changes to a SharePoint list view, which includes settings like Totals for a column.

    7. Configure the HTTP request as follows:

    - Method: POST
    - Uri: _api/web/lists/getbytitle('Your List Name')/views/getbytitle('Your View Name')
    - Headers:
    - Accept: application/json;odata=nometadata
    - Content-Type: application/json;odata=nometadata
    - If-Match: *
    - X-HTTP-Method: MERGE
    - Body: Use the following template, replacing 'Field Name' with the name of your column:

    ```
    {
    "ViewQuery": "<View><Query/><ViewFields><FieldRef Name='Field Name'/></ViewFields><Aggregations Value='On'><FieldRef Name='Field Name' Type='SUM'/></Aggregations></View>"
    }
    ```

    8. Once you've done all this, save and run the flow. The Totals for your column should be set on the new list.

    Please note that you'll need to replace 'Your List Name', 'Your View Name', and 'Field Name' with your specific list, view, and field names. The Type attribute in the Body JSON should be changed to reflect the type of total you want (e.g., 'SUM', 'AVG', etc.).

    Also, please be aware that modifying SharePoint via REST API calls requires careful handling and adequate permissions. Always test on non-production environments first to ensure no unwanted changes are made.

     

  • Ninijca Profile Picture
    43 on at

    Thank you so much @Expiscornovus and @sandeepstw! I tried both and it worked! 

  • sandeepstw Profile Picture
    312 Moderator on at

    Please give kudos as well thanks 

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 389

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard