Density uses the time-weighted averages method to calculate the “average” for our key metrics. Because the average is an aggregate metric, it is always determined with respect to a *period* of time (timestamp range), not a point in time (timestamp).

For any period of time, the **average occupancy** is calculated from the series of instantaneous count changes in that period of time (including the “initial count” at the start of the period). Each instantaneous count change is multiplied by the number of (micro|milli) seconds until either the *next* count change or the end of the period. These are then summed, and the total is divided by the total number of (micro|milli) seconds in the period:

Where:

**n**is the number of instantaneous count changes in the period**ci**is the count after count change i**ti**is the time at instantaneous count change i**c0**is the count at the start of the period**t0**is the start of the period**tn+1**is the end of the period

**Example: **The Average Occupancy is calculated as the number of people present each second, averaged over the total number of seconds. Let’s look at an example of how the average occupancy is calculated for a 15-minute period with a total of 5 people arriving at different times. Two people entered the conference room during the first minute, another two entered at minute 6, and 1 last person entered at minute 11.

The average is calculated as the sum of (people*sec)/sum of (# of seconds).

In this case, (600+1200+1500)/(300+300+300) = 3.7

For more information, please see Density Metrics and How They Are Calculated