How to get Summation of Columns from Sharepoint or Dataverse into Invoices in Power Automate

In Dataverse/Sharepoint or any other dataset you cannot directly add a formula column and populate the summation of column into invoices

High level resolution steps

To achieve this, we have make use of Power Automate, where we Initialize/set a temp variable and global variable.

Detailed resolution steps

Step 1: Have a list of quantity/Unit column in your Share point/Dataverse as shown below:

Step 2: Go to make.powerautomate.com and list the rows of your SharePoint list using “Get Items” action as shown below:

Step 3: Initialize the variable totalqty as well as initialize another temporary variable as tempqty as shown below:

Step 4: Apply a loop and get the items of SharePoint list as shown below:

Step 5: Now set the global variable and temporary variable within the same “Apply to each” loop as shown in the below fashion:
Refer the formula that I have set in the “totalqty”:
Here, I am adding the original quantity from sharepoint list along with temporary variable.

Step 6: Now map the field into the invoice using “Populate a Microsoft word template” as shown below:

Step 7: Create this invoice file and store in OneDrive as shown below:

Output:

Now you can see that the SharePoint data has been populated and summation has been placed in the total columns.