If you want to sum the values row by row, you need to ensure that each gallery has the same number of items and that the items are in the correct order.
Sum(
Filter(
GalleryOne.AllItems,
ID = ThisItem.ID
),
TotalCost
) + Sum(
Filter(
GalleryTwo.AllItems,
ID = ThisItem.ID
),
TotalCost
) + Sum(
Filter(
GalleryThree.AllItems,
ID = ThisItem.ID
),
TotalCost
)
This formula adds the "Total Cost" from the item in Gallery One, Gallery Two, and Gallery Three that has the same ID as the current item in Gallery Four.