Summing filtered dataset data in a text element on a dynamic page

Question:
I have a dynamic page that shows a travel itinerary (pulled from the dynamic dataset). On this page, there’s a repeater that shows multiple reservations from a separate database, filtered in dataset settings to only show reservations that belong to the itinerary.

Each of the reservations has a total sum. On my dynamic page I would like to aggregate these total sums so I can show the total costs of all reservations together, that make the total costs of this trip. This will be shown in a text element.

I have been looking at for example this post but I can’t seem to get the coding right.

Could ayone steer me in the right direction?

Thanks so much!

Product:
Wix Studio