I have a records table with site numbers and abundances of different species at that site (e.g. site 1 has 6 common bats and 13 pipistrellus bats).
I would like to sum total number (i.e. 6+13=19) at that site into another column within another table of a point shapefile locating the sites in some kind of expression used in the field calculator. Is this possible?
I have tried
aggregate( 'records', 'sum', "Abundance", "SiteNum")
but this has given me the same value (808) for every site in the new column of the point shapefile attribute table i.e. is ignoring the factor of site number.
aggregate
-expression of the field calculator?sum
part should read something like...'sum("Abundance",group_by:="SiteNum")'...
- but to be honest I have no idea what theaggregate
- expression should read then. Aggregate is like dark humor - not everyone gets it.sum(Abundance,SiteNum)
should work fine. So, what happens if we go withaggregate('layernamefromthefieldcalc','max','sum(Abundance,SiteNum)')
? It is important that you use the layername with which the abundance-layer is referenced under in the field calculator (point "map layer") - the simple'records'
wont work most likely.