You would have to store the values somewhere every turn.
This may already be done for you, since the data for the graphs you can look at has to come from somewhere. So if the number used for the Economy graph is close enough to what you want, you could used the data from that. The screen that draws the graphs uses this function to do it:
gc.getPlayer(iPlayer).getEconomyHistory(iTurn)
And I just checked to see what the DLL stores in that history value and it is, in fact, the results of a call to calculateTotalCommerce(). Therefore it is exactly what you want: a record of what you get from calculateTotalCommerce() on every turn of the game so far.