GDP is calculated by adding up the total value of goods and services produced within a country during a specific time period.