I have to make a few assumptions on your setup, so I’ll provide 2 options:
- Here’s an example for when an button is clicked to add a new location to a repeating group.
When button is clicked > set state on Page’s Total Distance > Value = Page’s Total Distance + New Location’s address’s distance from Repeating Group :last item’s address
- Example for saving the distance between each leg and using that to sum.
When button is clicked > make change to new leg, “distance from previous leg” = This leg’s address’s distance from Repeating Group’s list of Legs (or search for legs in this itinerary) :last item’s address. Then use a text element to display a list of all legs’s address :sum
Lots of assumptions… if you want to share a little more about your structure, I can help with the route that makes the most sense.