I have a polygon layer of ski resorts call skiResorts
. I have a liner layer of pistes called pistes
. The pistes layer has 2 several attributes and include aa_piste_length
and aa_piste_difficulty
. aa_piste_difficulty
includes 3 categories, namely, beginner
, intermediate
and advanced
.
In the skiResorts
layer, I would like to make 3 new calculated fields, namely, beginner_length
, intermediate_length
and advanced_length
which sums the value of aa_piste_length
. For example, beginner_length
in the skiResorts
layer would be the sum of all aa_piste_difficulty
that equals beginner
and is within that particular skiReport
polygon.
I am very confused as to how to do this. Do I need to make a one to many relationship between skiResorts and pistes? Can I just use aggregate in the Field Calculator to do this?
I have tried below but still have questions how to complete it.
aggregate(layer:= 'pistes',
aggregate:= 'sum',
expression:= ?? what does here?? ,
filter:= ?? how to say where piste_difficulty = beginner ??
)