Esri Arcade Labeling Expression
Finds related records between two layers in a web map.
var aTable = $feature.aTableAttributeID;
var relate = "bTableAttributeID = '" + $feature.aTableAttributeID + "'";
var bTable = FeatureSetByName($map, 'bTableNameInWebMap');
var match = Filter(bTable, relate);
var cnt = Count(match);