I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got two polygon layers
B with multiple features in each. I want to calculate, for each feature in layer
A, the percentage of its area that is actually covered by any feature of layer
B. I have built in the field calculator of layer
A the following code, that seems to work in some cases, but definitely doesn't in others
(area(intersection($geometry, collect_geometries(overlay_intersects('B', $geometry)))))*100/area($geometry)
Any idea of what's wrong?