To calculate subtotal for a table, the first step is to use the convert to range button on the table tools design tab.
The button is used to stop working with your data in a table without losing any table style formatting that you have applied. It enables converting the data so it will become a part of the worksheet.