# Real-Time Expressions: Compute Energy Costs

## Overview

Compute energy costs from Watts logged. This operation will use a combination of the summary statistics tile view and real-time expressions.## Syntax

Tile Type: Summary Total (Events measured in Hours).

Real-Time Expression:

*=[data stream]/1000*<cost per kWh>*

## Example

A data stream from a smart outlet,*Kitchen Outlet(power)*, is logging data in Watts. This data stream needs to be converted to cost.

Add a tile and select the Tile Type to be Summary. Under the Summary Value drop-down, select Total. There are two options under Total Basis.

*Events by value*will simply add up every value in the data stream into a single summation. In the example above, there have been 33,953,657.80 Watts logged over time.

Watts needs to be converted to Watt-hours (Wh). To do this, simply select the second option under Total Basis,

*Events measured in Hours*. In the example above, there have been 2,692.40 Wh used.

Next, convert Wh to kWh by using a simple real-time expression to divide by 1000. In the example above, the expression is:

*=[Kitchen Outlet(power)]/1000*

**

The final step is to multiply the total kWh by the your electricity rate, typically expressed as the cost per kWh. In the example above, the kWh rate is $0.10. The final expression is:

*=[Kitchen Outlet(power)]/1000*0.10*

The final computation for the total energy costs for the kitchen outlet is $0.27. Selecting specific time ranges in the timeline will automatically update this calculation for the energy costs in that time range.