It seems like the issue you're facing in Power Apps is due to the use of a global variable (RunningTotal) to calculate the running total. When you update another record, the global variable is still being used, and that's why the running total for the first record changes.
To fix this, you need to ensure that each record has its own independent running total. One way to achieve this is by using a collection to store the running totals for each record. Collections in Power Apps are in-memory tables that can hold data during the session.
Here's how you can modify your approach to handle the running total for each record:
Create a collection to store the running totals:
In the OnStart property of your app, add the following code to create the collection:
ClearCollect(RunningTotalsCollection, { RecordID: "", RunningTotal: 0 })
Modify the Add button's OnSelect property:
Update the OnSelect property of your Add button to add the current record's running total to the collection.
Collect(RunningTotalsCollection, { RecordID: ThisItem.ID, RunningTotal: RunningTotal + TextInput1 })
Display the running total in your form:
Instead of using the global variable directly, use the collection to display the running total for the current record in your form.
LookUp(RunningTotalsCollection, RecordID = ThisItem.ID, RunningTotal)
By following these steps, each record will have its own running total value stored in the collection. Updating one record won't affect the running total for another record.
Remember to replace TextInput1 with the appropriate control or variable name that holds the value to be added to the running total. Also, make sure to adjust the RecordID field in the collection based on your data source's unique identifier for each record. If your data source doesn't have a unique identifier for each record, consider using a combination of fields that can uniquely identify each record.