Мало условий, вариант если выбираемый элемент в "группе" с наибольшим ID
use Bitrix\Main\Loader;
use Bitrix\Iblock\ElementTable;
use Bitrix\Iblock\ElementPropertyTable;
use Bitrix\Main\Entity\ExpressionField;
Loader::includeModule('iblock');
$iblockId = 1;
$propertyId = 1;
$elementIds = [];
$iterator = ElementPropertyTable::getList([
'select' => [new ExpressionField('ID', 'MAX(%s)', 'IBLOCK_ELEMENT_ID'), 'VALUE'],
'filter' => ['IBLOCK_PROPERTY_ID' => $propertyId, '!VALUE' => false],
]);
while($row = $iterator->fetch()) {
$elementIds[] = $row['ID'];
}
$elements = ElementTable::getList([
'select' => ['ID', 'NAME'],
'filter' => ['IBLOCK_ID' => $iblockId, 'ID' => $elementIds],
])->fetchAll();
print_r($elements);