# Step 4 - Calculate Actual Savings

- switch

## Calculate Actual Savings

The final step is to use the Calculation API to calculate what the customerâ€™s bill cost would have been if they did not install solar. With this you can then determine their Actual Savings. You can read our documentation on Account Cost Calculation for more information.

## Calculating What the Bill Would Have Been Without Solar Production

To calculate what the bill without solar would have been, you need to back out the impact of solar production on the net electricity usage at the grid. Below is a sample request that does that for a billing period. Note that you are explicitly adding the solar production back into the electricity load by adding a tariff input entry with the actual solar production `profileId`

(or `providerProfileId`

) and the `operator`

of `+`

.

```
POST /rest/v1/accounts/pid/{providerAccountId}/calculate/
```

1
2
3
4
5
6
7
8
9
10
11
12
13
14

{
"fromDateTime":"2015-07-20T00:00-0700",
"toDateTime":"2015-08-19T00:00-0700",
"billingPeriod": true,
"minimums": false,
"groupBy":"MONTH",
"detailLevel":"CHARGE_TYPE",
"tariffInputs": [ {
"keyName": "profileId",
"dataValue": "{profileId of solar profile}",
"operator": "+"
}
]
}

## Calculating What the Bill Would Have Been With a Tariff Change

If you would like to see the costs for a customer who switched tariffs when they installed solar, then include the `masterTariffId`

of the pre-solar tariff for Bills Without Solar. The calculation will then use the rates of the pre-solar tariff. Here is an example:

```
POST /rest/v1/accounts/pid/{providerAccountId}/calculate/
```

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

{
"fromDateTime":"2015-07-20T00:00-0700",
"toDateTime":"2015-08-19T00:00-0700",
"masterTariffId":"{masterTariffId of pre-solar tariff}",
"billingPeriod": true,
"minimums": false,
"groupBy":"MONTH",
"detailLevel":"CHARGE_TYPE",
"tariffInputs": [ {
"keyName": "profileId",
"dataValue": "{profileId of solar profile}",
"operator": "+"
}
]
}

In some rare cases you might want to back out rate applicability changes, for example, in order to understand costs without the tariff change and without enrolling in a smart rate option. To do this, pass in additional tariff inputs with the rate applicability property values you would like to use.

## Calculate the Actual Savings

The final step is to calculate the Actual Savings. Utility savings are found by subtracting the Bill Without Solar cost from the Actual Bill cost. To get net savings, also subtract the actual Solar cost.

For example, for the billing period of 7/20/2015 to 8/19/2015, there is an Actual Bill cost of -$61.79, a Bill Without Solar cost of $199.61, and a Solar cost of $185.44. Therefore, the Actual Savings is:

Bill Without Solar - Actual Bill - Solar Cost = Actual Savings

$199.61 - (-$61.79) - $185.44 = $75.96