Hi @hainguyen
Please follow This as per your requirement.
1. Use Get Items Action and get all the items from list 1

2. Use One Select Action and Select Only Name From get Items Action.

3. Use one Compose Action and perform union on body which return by select Action.

union(body('Select'),body('Select'))
4. Then use one Apply to each Action and provide value which return by union.

5. In apply to each Action use one filter Action and filter list 1 according to Name (which is current value of apply to each).


items('Apply_to_each')?['Name']
6. Then use one compose Action rename to JSON and provide expression.

{
"root": {
"Numbers": @{body('Filter_array')}
}
}
7. Then Use one another compose Action rename to SUM and provide expression.

xpath(xml(outputs('JSON')), 'sum(/root/Numbers/SL)')
Note: In expression SL is a column name of List 1
8. Use Get item action and list items from List 2 according to filter query.

Note: In filter query name also enclose with single quotes.
items('Apply_to_each')?['Name']
9. Then Use one condition Action.

empty(outputs('Get_items_From_List_2')?['body/value'])
10. create or update list 2 according to condition output.




In Update item Action
Id:
outputs('Get_items_From_List_2')?['body/value']?[0]?['ID']
Title:
outputs('Get_items_From_List_2')?['body/value']?[0]?['Title']
Name:
outputs('Get_items_From_List_2')?['body/value']?[0]?['Name']
Total:

Complete Flow

SPL List1:

SPL List2:

Hope it helps!