How to Flag the Top-Scored Prospect Within Each Company Using Lookup Multiple Rows and Formulas
Hey everyone 👋 I'm trying to flag the top-scored prospect within each company in my table (700 prospects, 78 companies). Each prospect has an AI-generated lead score based on their job title. Here's my setup: - I have a Lookup Multiple Rows column on the same table, filtered by Company Name = current row's Company Name - I'm trying to use a Formula column to compare the current row's Lead Score to the max score from the lookup results The Clay Formula Generator gave me this: ``` {{Lead Score}} == _.maxBy({{Lookup Multiple Rows in Other Table}}?.filter(row => row?.["Company Name"] == {{Company Name}}), row => Number(row?.["Lead Score"]))?.["Lead Score"] ? "⭐ Top Lead" : "" ``` I also tried a simplified version removing the redundant `.filter()`: ``` _.maxBy({{Lookup Multiple Rows in Other Table}}, row => Number(row?.["Lead Score"]))?.["Lead Score"] == {{Lead Score}} ? "⭐ Top Lead" : "" ``` Both return empty results or errors. Has anyone managed to find the max value from a Lookup Multiple Rows result and compare it to the current row? Would love to know the right syntax or maybe you would have an other solution ? 🙏
