List Customizer or Column Formatting to Sum a calculated column?

Brass Contributor

I have a list in modern experience, SharePoint Online, that I want to be able to sum a calculated column, like we are able to do with other columns. From what I have been reading, the traditional OOTB approach isn't achievable, so I'm wondering if it is possible to get this by utilizing list customizers or some fancy column formatting solution? Currently, with my limited knowledge, I can't find a solution, but am hoping the vast knowledge of the SharePoint world may be able to help with a solution?


Any help appreciated!




3 Replies

Hi Jennie (@Jennie Sheridan), that was an interesting &  fun challenge and I had to think a bit out of the box to achieve it. But there is a way to do this using a flow in Power Automate and some JSON column formatting.


I've used a list I already had which has a couple of number columns called Number and Times. There is then a calculated column called Total. I've added 2 extra columns: a number column called FlowTotal where I've added a sum total, and a single line of text column called RunFlow for the button to trigger the flow. Whenever you want to update the sum of the FlowTotal column you need to press the button.




The RunFlow column is formatted with JSON code to only display the button to run the flow if the ID number of the item is 45. If I hadn't done that the button would have displayed on every item in the list and we only need it in one place.


The JSON formatting code is shown below. You'll need to change the ID to be the ID of your flow (from the browser address bar when you are in Power Automate) and change the ID to whatever the ID is of the item where you want the button:



  "elmType": "button",
  "txtContent": "Calculate",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"89bca802-d246-456f-b58f-e6c326eb9cf2\"}"
  "style": {
    "background-color": "#02767a",
    "color": "#ffffff",
    "outline": "transparent",
    "border-width": "1px",
    "border-style": "solid",
    "border-color": "transparent",
    "cursor": "pointer",
    "font-size": "12px",
    "visibility": "=if(([$ID] == '45'),'visible','hidden')"




In the flow the trigger is a SharePoint For a selected item trigger and in it you select your site and list. The first action is a SharePoint Get items action as we want to get all the items in the list.


Next, add an Apply to each and select value from the dynamic content. 


Then add a Compose action and select the Total column from the dynamic content. I've renamed this to ComposeTotal:



Next, add another Compose action (I've renamed it to ComposeInt). Click in the field and when the dynamic content opens click the Expression tab and type int(outputs('ComposeTotal'))

followed by OK. A compose control outputs in text format so we need to change the total back to an integer, hence the int in the expression.
Next add a Format number action and select the ComposeInt output from the dynamic content. You can leave the format as the default with 2 decimal places or, as I have done, just enter a # which will remove the decimal places.




Finally we update the SharePoint item, selecting for the FlowTotal column the output of the Format number action.




If you have a very large list it will take a while for the flow to run and to populate the FlowTotal column and display the sum. And even on a small list like this it takes a few seconds,  but it works successfully.




There's a very short video below which shows it in action. Hope that helps but come back with any questions about it.




A variation of the flow would be to run it whenever any item in the list was created or modified. That would remove the need for the button.

Los Gallardos
Microsoft Power Automate Community Super User


Wow, thank you @RobElliott!  I work with Jennie and am going to put this to use.  Very much appreciated!

@Jeff MacPhail glad I could help.


Los Gallardos
Microsoft Power Automate Community Super User