It's a little hard to know without seeing the full schema of your layers. Are they truly related, and part of the same service, or do they simply share a field?
I've got a very similar solution in one of my webmaps I'd be happy to share with you, but it depends a lot on how the layers are set up.
The Not-Actually-Related Layer Solution
Given two layers, parcels and parcel sales, I can use the following Arcade expression on the parcels layer to bring in an attribute from the sales table.
// Assign feature id field to variable
var id = $feature.pin
// Get other layer
var otherLayer = FeatureSetByName($map,"Parcel_Sales")
// Filter other layer by matching id
var otherFeatures = Filter(otherLayer, 'property_key = @ID')
// Sort returned features
var sortedFeatures = OrderBy(otherFeatures, 'sale_date DESC')
// Grab the first feature in the FeatureSet
var f = First(sortedFeatures)
// Return sale amount of latest sale
return f.sale_amount
Here's how it looks in action:
Of course, there's no reason some of those functions couldn't be combined into one, but I kept them all separate for clarity.
- Josh Carlson
Kendall County GIS