If you have built a relationship class, you can get the related table entries like this:
var related = FeatureSetByRelationshipName($feature, "NameOfTheRelationshipClass")
If not, you have to load and filter the table like this:
var table = FeatureSetByName($datastore, "NameOfTheTable")
var id = $feature.PrimaryKey
var related = Filter(table, "ForeignKey = @ID")
And then it depends on what you want to extract from the related table entries. Some examples:
// Return the count
return Count(related)
// return max/min/mean/sum of a field
return Max(related, "FieldName")
Have a great day!
Johannes