So the actual answer is broken up by field.
Total Sales is a SUM field of the "Sales LCY" field from the customer ledger entry table for the current fiscal year.
The same can be said of the Profit. It is summing up the "Profit LCY" field from the customer ledger Entry table.
For the cost this is only used if you sell items or resources. It uses the value entries table for items to sum up the "Cost Amount (Actual)" field for that customer using the "Source No." Field. Only entries which aren't of an entry type "Revaluation" are included. Note that any flowfilters applied to the page will be picked up in the calculation such as "Date Filter" or for the global dimensions. For the resource it goes to the resource ledger Entry table and sums up the "Total Cost" field using the "Source No." Field as the customer no. in question. Again flowfilters apply.