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 / Solutions for Dynamic ...
Power Automate
Unanswered

Solutions for Dynamic Lists on Power Automate Desktop

(0) ShareShare
ReportReport
Posted on by 23

Hi guys, 

 

I have extracted a datatable from excel which has all the values that I need. My goal is to calculate the sum of all values present in Column H (Amount in local currency) and the sum of all the values present in Column I (Arrears after net due date), with respect to the names in Colum C (Name 1)

 

The names can be anywhere in the excel table.

 

Please refer to the table below. 

 

CustomerName 1Net due dateAmount in local currencyArrears after net due date
1000ABC2/4/2006-10,000.980
1001CDE4/23/2010-7.000
1002EFG5/16/2015-815.493,050
1003HIJ2/10/2006-28.000
1004HIJ2/4/2006-7,527.930
1005HIJ8/26/2013-281.683,678
1006ABC4/15/2017-1,010.092,350
1007CDE10/20/2021-1,954.06701
1008EFG3/22/2007-2,790.000
1009ABC3/30/2012-451.510
1010CDE11/19/2012-426.003,958
1011EFG6/29/2003-5.477,389
1012HIJ2/7/2006-0.550
1013HIJ10/7/2003-395.007,289
1014HIJ5/21/2019-1,249.001,584
1015ABC2/9/2023-854.52224
1016CDE6/12/2021-939.00831

 

 

So basically what I need is the following example:

 

NameTotal Amount in Local CurrencyArrears
ABC432435334324
CDE300001200
EFG6000- 3452

 

Any help will be appreciated!

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Assuming you have your data table in %ExcelData%, the following flow should do it:

    Agnius_0-1696489857894.png

    The idea behind this flow is as follows:

    1. You get the list of names via Retrieve data table column into list
    2. You get a list of unique names by using Remove duplicate items from list. This will result in a list where each name is only included once.
    3. You create a new data table for output by using Create new data table
    4. You remove the first row from the new data table, because Create new data table will create it with a single empty row by default. So we use Delete row from data table to remove it.
    5. You then loop through the list of unique names in a For each loop where:
      1. You set the amount to 0 via Set variable
      2. You set the arrears to 0 via Set variable
      3. You use Find or replace in data table to find all rows in your %ExcelData% where the name equals the current name
      4. You loop through the matched rows via another For each loop, where:
        1. You convert the row index to a numeric value by using Convert text to number. This is needed because for some reason the Find or replace in data table action will return the row indexes as strings, but they need to be converted to numbers in order to be used when referencing the table rows.
        2. You then use the row index to retrieve the amount and convert it to a numeric value via Convert text to number.
        3. You do the same as above for the arrears value via Convert text to number.
        4. You use Increase variable to increase the amount value with the current amount you just converted.
        5. You do the same to the arrears value via Increase variable.
      5. When the nested loop for the current name ends, you use Insert row into data table to insert a row for the current name with its total values into the output table.

    This will result in a %DataTable% variable that will have each name only included once and the two numeric values included as totals. Essentially a sub-total table.

     

    Here's a code snippet that you can copy and paste into your PAD flow designer to have these actions created for you:

    Variables.RetrieveDataTableColumnIntoList DataTable: ExcelData ColumnNameOrIndex: $'''Name 1''' ColumnAsList=> NamesList
    Variables.RemoveDuplicateItemsFromList List: NamesList IgnoreCase: False
    Variables.CreateNewDatatable InputTable: { ^['Name', 'Amount', 'Arrears'], [$'''''', $'''''', $''''''] } DataTable=> DataTable
    Variables.DeleteRowFromDataTable DataTable: DataTable RowIndex: 0
    LOOP FOREACH CurrentName IN NamesList
     SET Amount TO 0
     SET Arrears TO 0
     Variables.FindOrReplaceInDataTable.FindItemInDataTableByColumnIndex DataTable: ExcelData AllMatches: True ValueToFind: CurrentName MatchCase: True MatchEntireCellContents: True ColumnNameOrIndex: $'''Name 1''' DataTableMatches=> DataTableMatches
     LOOP FOREACH MatchedRowData IN DataTableMatches
     Text.ToNumber Text: MatchedRowData['Row'] Number=> RowIndex
     Text.ToNumber Text: ExcelData[RowIndex]['Amount in local currency'] Number=> CurrentAmount
     Text.ToNumber Text: ExcelData[RowIndex]['Arrears after net due date'] Number=> CurrentArrears
     Variables.IncreaseVariable Value: Amount IncrementValue: CurrentAmount
     Variables.IncreaseVariable Value: Arrears IncrementValue: CurrentArrears
     END
     Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: [CurrentName, CurrentAmount, CurrentArrears]
    END
    

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

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 248 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 160 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 142 Super User 2026 Season 2

Last 30 days Overall leaderboard