• My apologies. That row shouldn't be returned as 1200.0 but as 2500.0. I can completely understand the confusion.

    The logic is where document type (doc_type column) is 'S' for 'Starting', 'E' for Ending; grab the associated 'A' record.