Hi Lluís,
If I understand correctly your question, this is the structure of your survey: you have an entity tree with attributes species and height and another entity tree_2 with an attribute species_2.
To simplify your calculations you can add a calculated attribute in tree_2 to store the value of the tallest tree with the same species specified in each row of tree_2 (call this attribute ht): the expression to write in the Calculated value is: math:max(parent()/tree[species = $context/species_2]/height).
Then you can define another calculated attribute dbhh with an expression like this: ht * 3.
In the end you can use the value of dbhh in a comparison check inside your dbh attribute of the tree_2 entity.
Does it fits your needs?
Many thanks,
Open Foris Team