# Mean of polygons area within another polygon layer

Try this expression on your `Sectors`

layer's attribute table:

```
aggregate(layer := 'Houses',
aggregate:= 'mean',
expression:= "area",
filter:= within(centroid($geometry), geometry(@parent)))
```

A quick test output ("ave" field) below:

You can calculate the mean area of houses using the Field Calculator to create a new field in the *Sectors* layer.

Use this expression

```
(to_string(array_sum(aggregate(
layer:= 'Houses',
aggregate:='array_agg',
expression:=$area,
filter:=contains(geometry(@parent), $geometry)))))
/
(aggregate(
layer:='Houses',
aggregate:='count',
expression:=$id,
filter:=intersects(geometry(@parent), ($geometry))))
```

The first part of the expression calculates the sum of all the *Houses* areas inside each sector. The second part calculates the number of *Houses* inside the sector.
A simple division of the first number by the second will give you the request information