I'm having trouble with an Arcade data source that I want to use in a dashboard (Enterprise 11.1). The goal is to take some inspections in Cityworks and sort them into bins based on what year in a 5-year cycle they fall in, to help managers rebalance them.
The problem is, the expression returns fewer values than it pulls in initially. Even more perplexing, the exact number of records returned each time is different:

Here's the code I'm using (server names changed to protect the innocent). Is there something I'm missing in the code that could cause that?
var portalItem = 'RanDOmP0rta1iDNUm85r';
var thisPortal = Portal('https://myserver.mydomain.com/portal');
var inspections = FeatureSetByPortalItem(thisPortal, portalItem, 58,['InspectionId','PrjStartDate','ShopDescription','DistrictDescription']);
//create dict to store updated features
var cycleYears = {
'fields': [{'name':'InspectionID', 'type': 'esriFieldTypeOID'},
{'name':'ShopDescription', 'type': 'esriFieldTypeString'},
{'name':'District', 'type': 'esriFieldTypeString'},
{'name':'CycleYear','type': 'esriFieldTypeDouble'}],
'geometryType': '',
'features': []
}
var count1 = Count(inspections);
console(`Records in: ${count1}`);
//put the year in each record into a bin
//append to dict
for(var f in inspections) {
var cycleYear = (Year(f.PrjStartDate) % 5) +1;
var new_f = {'attributes': {'InspectionID':f.InspectionID,
//'PrjStartDate':f.PrjStartDate,
'ShopDescription':f.ShopDescription,
//'Text1': f.Text1,
'District': f.DistrictDescription,
'CycleYear': cycleYear
}}
Push(cycleYears.features, new_f)
}
//convert to feature set and output as data source
var inspCounts = FeatureSet(Text(cycleYears));
var count2 = Count(inspCounts)
console(`Records out: ${count2}`);
return inspCounts;