In Excel once we create a pivot table we can add and modify the formula available in default calculated fields. In the Formula field use the following formula. I have been able to resolve this problem by using the free Power Pivot add-in from Microsoft for Excel 2010 and higher versions.
You may refer to my solution in this workbook.
In such a case you can follow the steps below to Add Subtotals in Pivot Table. Custom Calculations enable you to add many semi-standard calculations to a pivot table. In Excel once we create a pivot table we can add and modify the formula available in default calculated fields. In the Layout group click Subtotals and then click Show All Subtotals at Bottom of Group.