Totals is generally calculated at the server-side & our server-side logic dedupes the duplicate value. For example, if a visitor starts his journey at 11:45 PM & continues to browse the web site until 12:10 AM then you if will see one Visit against each line item if you try to look at hourly visits report but the total will show Visit as 1 for this scenario as the same Visit persisted from the previous day.
As you mentioned that when you try to apply the segment below the calculated metric then the total is not matching. So, think this is happening because there will be some segment that contains the duplicate data.
Can you please share the segment definition that you are using along with the calculated metric?