well, that is my aggregation function - should be the only one in the LOAD.
There must be something wrong based on the table_structure.
I have for now replaced that with the slightly longer way of concatenating five RESIDENT LOADs, one with max(5), one with max(4) and so on - now QV is multiplying the nr. of records by five - that means there must be some field that is absolutely unique in every record of the table - that is included in the GROUP BY clause, causing QV to sort of make a separate "data_heap" of every record and then loading it in every one of my five RESIDENT LOADs....
// floor(today() + rand()*1000) as d,
// floor(rand()*100) as exp
//store testdata into testdata.qvd (qvd);
load * from testdata.qvd (qvd);
top5: // last 5 date
first 5 load d;
load d, max(1) as m
group by d
order by d desc;
inner join (testdata) load d Resident top5;
DROP Table top5;